001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.shopping.service.persistence;
016    
017    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
018    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
019    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
020    import com.liferay.portal.kernel.dao.orm.FinderPath;
021    import com.liferay.portal.kernel.dao.orm.Query;
022    import com.liferay.portal.kernel.dao.orm.QueryPos;
023    import com.liferay.portal.kernel.dao.orm.QueryUtil;
024    import com.liferay.portal.kernel.dao.orm.Session;
025    import com.liferay.portal.kernel.exception.SystemException;
026    import com.liferay.portal.kernel.log.Log;
027    import com.liferay.portal.kernel.log.LogFactoryUtil;
028    import com.liferay.portal.kernel.util.GetterUtil;
029    import com.liferay.portal.kernel.util.InstanceFactory;
030    import com.liferay.portal.kernel.util.OrderByComparator;
031    import com.liferay.portal.kernel.util.SetUtil;
032    import com.liferay.portal.kernel.util.StringBundler;
033    import com.liferay.portal.kernel.util.StringPool;
034    import com.liferay.portal.kernel.util.StringUtil;
035    import com.liferay.portal.kernel.util.UnmodifiableList;
036    import com.liferay.portal.model.CacheModel;
037    import com.liferay.portal.model.ModelListener;
038    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
039    
040    import com.liferay.portlet.shopping.NoSuchItemFieldException;
041    import com.liferay.portlet.shopping.model.ShoppingItemField;
042    import com.liferay.portlet.shopping.model.impl.ShoppingItemFieldImpl;
043    import com.liferay.portlet.shopping.model.impl.ShoppingItemFieldModelImpl;
044    
045    import java.io.Serializable;
046    
047    import java.util.ArrayList;
048    import java.util.Collections;
049    import java.util.List;
050    import java.util.Set;
051    
052    /**
053     * The persistence implementation for the shopping item field service.
054     *
055     * <p>
056     * Caching information and settings can be found in <code>portal.properties</code>
057     * </p>
058     *
059     * @author Brian Wing Shun Chan
060     * @see ShoppingItemFieldPersistence
061     * @see ShoppingItemFieldUtil
062     * @generated
063     */
064    public class ShoppingItemFieldPersistenceImpl extends BasePersistenceImpl<ShoppingItemField>
065            implements ShoppingItemFieldPersistence {
066            /*
067             * NOTE FOR DEVELOPERS:
068             *
069             * Never modify or reference this class directly. Always use {@link ShoppingItemFieldUtil} to access the shopping item field persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
070             */
071            public static final String FINDER_CLASS_NAME_ENTITY = ShoppingItemFieldImpl.class.getName();
072            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073                    ".List1";
074            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075                    ".List2";
076            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
077                            ShoppingItemFieldModelImpl.FINDER_CACHE_ENABLED,
078                            ShoppingItemFieldImpl.class,
079                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
080            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
081                            ShoppingItemFieldModelImpl.FINDER_CACHE_ENABLED,
082                            ShoppingItemFieldImpl.class,
083                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
084            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
085                            ShoppingItemFieldModelImpl.FINDER_CACHE_ENABLED, Long.class,
086                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
087            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ITEMID = new FinderPath(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
088                            ShoppingItemFieldModelImpl.FINDER_CACHE_ENABLED,
089                            ShoppingItemFieldImpl.class,
090                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByItemId",
091                            new String[] {
092                                    Long.class.getName(),
093                                    
094                            Integer.class.getName(), Integer.class.getName(),
095                                    OrderByComparator.class.getName()
096                            });
097            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID =
098                    new FinderPath(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
099                            ShoppingItemFieldModelImpl.FINDER_CACHE_ENABLED,
100                            ShoppingItemFieldImpl.class,
101                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByItemId",
102                            new String[] { Long.class.getName() },
103                            ShoppingItemFieldModelImpl.ITEMID_COLUMN_BITMASK |
104                            ShoppingItemFieldModelImpl.NAME_COLUMN_BITMASK);
105            public static final FinderPath FINDER_PATH_COUNT_BY_ITEMID = new FinderPath(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
106                            ShoppingItemFieldModelImpl.FINDER_CACHE_ENABLED, Long.class,
107                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByItemId",
108                            new String[] { Long.class.getName() });
109    
110            /**
111             * Returns all the shopping item fields where itemId = &#63;.
112             *
113             * @param itemId the item ID
114             * @return the matching shopping item fields
115             * @throws SystemException if a system exception occurred
116             */
117            @Override
118            public List<ShoppingItemField> findByItemId(long itemId)
119                    throws SystemException {
120                    return findByItemId(itemId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
121            }
122    
123            /**
124             * Returns a range of all the shopping item fields where itemId = &#63;.
125             *
126             * <p>
127             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.shopping.model.impl.ShoppingItemFieldModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
128             * </p>
129             *
130             * @param itemId the item ID
131             * @param start the lower bound of the range of shopping item fields
132             * @param end the upper bound of the range of shopping item fields (not inclusive)
133             * @return the range of matching shopping item fields
134             * @throws SystemException if a system exception occurred
135             */
136            @Override
137            public List<ShoppingItemField> findByItemId(long itemId, int start, int end)
138                    throws SystemException {
139                    return findByItemId(itemId, start, end, null);
140            }
141    
142            /**
143             * Returns an ordered range of all the shopping item fields where itemId = &#63;.
144             *
145             * <p>
146             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.shopping.model.impl.ShoppingItemFieldModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
147             * </p>
148             *
149             * @param itemId the item ID
150             * @param start the lower bound of the range of shopping item fields
151             * @param end the upper bound of the range of shopping item fields (not inclusive)
152             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
153             * @return the ordered range of matching shopping item fields
154             * @throws SystemException if a system exception occurred
155             */
156            @Override
157            public List<ShoppingItemField> findByItemId(long itemId, int start,
158                    int end, OrderByComparator orderByComparator) throws SystemException {
159                    boolean pagination = true;
160                    FinderPath finderPath = null;
161                    Object[] finderArgs = null;
162    
163                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
164                                    (orderByComparator == null)) {
165                            pagination = false;
166                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID;
167                            finderArgs = new Object[] { itemId };
168                    }
169                    else {
170                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ITEMID;
171                            finderArgs = new Object[] { itemId, start, end, orderByComparator };
172                    }
173    
174                    List<ShoppingItemField> list = (List<ShoppingItemField>)FinderCacheUtil.getResult(finderPath,
175                                    finderArgs, this);
176    
177                    if ((list != null) && !list.isEmpty()) {
178                            for (ShoppingItemField shoppingItemField : list) {
179                                    if ((itemId != shoppingItemField.getItemId())) {
180                                            list = null;
181    
182                                            break;
183                                    }
184                            }
185                    }
186    
187                    if (list == null) {
188                            StringBundler query = null;
189    
190                            if (orderByComparator != null) {
191                                    query = new StringBundler(3 +
192                                                    (orderByComparator.getOrderByFields().length * 3));
193                            }
194                            else {
195                                    query = new StringBundler(3);
196                            }
197    
198                            query.append(_SQL_SELECT_SHOPPINGITEMFIELD_WHERE);
199    
200                            query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
201    
202                            if (orderByComparator != null) {
203                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
204                                            orderByComparator);
205                            }
206                            else
207                             if (pagination) {
208                                    query.append(ShoppingItemFieldModelImpl.ORDER_BY_JPQL);
209                            }
210    
211                            String sql = query.toString();
212    
213                            Session session = null;
214    
215                            try {
216                                    session = openSession();
217    
218                                    Query q = session.createQuery(sql);
219    
220                                    QueryPos qPos = QueryPos.getInstance(q);
221    
222                                    qPos.add(itemId);
223    
224                                    if (!pagination) {
225                                            list = (List<ShoppingItemField>)QueryUtil.list(q,
226                                                            getDialect(), start, end, false);
227    
228                                            Collections.sort(list);
229    
230                                            list = new UnmodifiableList<ShoppingItemField>(list);
231                                    }
232                                    else {
233                                            list = (List<ShoppingItemField>)QueryUtil.list(q,
234                                                            getDialect(), start, end);
235                                    }
236    
237                                    cacheResult(list);
238    
239                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
240                            }
241                            catch (Exception e) {
242                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
243    
244                                    throw processException(e);
245                            }
246                            finally {
247                                    closeSession(session);
248                            }
249                    }
250    
251                    return list;
252            }
253    
254            /**
255             * Returns the first shopping item field in the ordered set where itemId = &#63;.
256             *
257             * @param itemId the item ID
258             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
259             * @return the first matching shopping item field
260             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a matching shopping item field could not be found
261             * @throws SystemException if a system exception occurred
262             */
263            @Override
264            public ShoppingItemField findByItemId_First(long itemId,
265                    OrderByComparator orderByComparator)
266                    throws NoSuchItemFieldException, SystemException {
267                    ShoppingItemField shoppingItemField = fetchByItemId_First(itemId,
268                                    orderByComparator);
269    
270                    if (shoppingItemField != null) {
271                            return shoppingItemField;
272                    }
273    
274                    StringBundler msg = new StringBundler(4);
275    
276                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
277    
278                    msg.append("itemId=");
279                    msg.append(itemId);
280    
281                    msg.append(StringPool.CLOSE_CURLY_BRACE);
282    
283                    throw new NoSuchItemFieldException(msg.toString());
284            }
285    
286            /**
287             * Returns the first shopping item field in the ordered set where itemId = &#63;.
288             *
289             * @param itemId the item ID
290             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
291             * @return the first matching shopping item field, or <code>null</code> if a matching shopping item field could not be found
292             * @throws SystemException if a system exception occurred
293             */
294            @Override
295            public ShoppingItemField fetchByItemId_First(long itemId,
296                    OrderByComparator orderByComparator) throws SystemException {
297                    List<ShoppingItemField> list = findByItemId(itemId, 0, 1,
298                                    orderByComparator);
299    
300                    if (!list.isEmpty()) {
301                            return list.get(0);
302                    }
303    
304                    return null;
305            }
306    
307            /**
308             * Returns the last shopping item field in the ordered set where itemId = &#63;.
309             *
310             * @param itemId the item ID
311             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
312             * @return the last matching shopping item field
313             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a matching shopping item field could not be found
314             * @throws SystemException if a system exception occurred
315             */
316            @Override
317            public ShoppingItemField findByItemId_Last(long itemId,
318                    OrderByComparator orderByComparator)
319                    throws NoSuchItemFieldException, SystemException {
320                    ShoppingItemField shoppingItemField = fetchByItemId_Last(itemId,
321                                    orderByComparator);
322    
323                    if (shoppingItemField != null) {
324                            return shoppingItemField;
325                    }
326    
327                    StringBundler msg = new StringBundler(4);
328    
329                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
330    
331                    msg.append("itemId=");
332                    msg.append(itemId);
333    
334                    msg.append(StringPool.CLOSE_CURLY_BRACE);
335    
336                    throw new NoSuchItemFieldException(msg.toString());
337            }
338    
339            /**
340             * Returns the last shopping item field in the ordered set where itemId = &#63;.
341             *
342             * @param itemId the item ID
343             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
344             * @return the last matching shopping item field, or <code>null</code> if a matching shopping item field could not be found
345             * @throws SystemException if a system exception occurred
346             */
347            @Override
348            public ShoppingItemField fetchByItemId_Last(long itemId,
349                    OrderByComparator orderByComparator) throws SystemException {
350                    int count = countByItemId(itemId);
351    
352                    if (count == 0) {
353                            return null;
354                    }
355    
356                    List<ShoppingItemField> list = findByItemId(itemId, count - 1, count,
357                                    orderByComparator);
358    
359                    if (!list.isEmpty()) {
360                            return list.get(0);
361                    }
362    
363                    return null;
364            }
365    
366            /**
367             * Returns the shopping item fields before and after the current shopping item field in the ordered set where itemId = &#63;.
368             *
369             * @param itemFieldId the primary key of the current shopping item field
370             * @param itemId the item ID
371             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
372             * @return the previous, current, and next shopping item field
373             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a shopping item field with the primary key could not be found
374             * @throws SystemException if a system exception occurred
375             */
376            @Override
377            public ShoppingItemField[] findByItemId_PrevAndNext(long itemFieldId,
378                    long itemId, OrderByComparator orderByComparator)
379                    throws NoSuchItemFieldException, SystemException {
380                    ShoppingItemField shoppingItemField = findByPrimaryKey(itemFieldId);
381    
382                    Session session = null;
383    
384                    try {
385                            session = openSession();
386    
387                            ShoppingItemField[] array = new ShoppingItemFieldImpl[3];
388    
389                            array[0] = getByItemId_PrevAndNext(session, shoppingItemField,
390                                            itemId, orderByComparator, true);
391    
392                            array[1] = shoppingItemField;
393    
394                            array[2] = getByItemId_PrevAndNext(session, shoppingItemField,
395                                            itemId, orderByComparator, false);
396    
397                            return array;
398                    }
399                    catch (Exception e) {
400                            throw processException(e);
401                    }
402                    finally {
403                            closeSession(session);
404                    }
405            }
406    
407            protected ShoppingItemField getByItemId_PrevAndNext(Session session,
408                    ShoppingItemField shoppingItemField, long itemId,
409                    OrderByComparator orderByComparator, boolean previous) {
410                    StringBundler query = null;
411    
412                    if (orderByComparator != null) {
413                            query = new StringBundler(6 +
414                                            (orderByComparator.getOrderByFields().length * 6));
415                    }
416                    else {
417                            query = new StringBundler(3);
418                    }
419    
420                    query.append(_SQL_SELECT_SHOPPINGITEMFIELD_WHERE);
421    
422                    query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
423    
424                    if (orderByComparator != null) {
425                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
426    
427                            if (orderByConditionFields.length > 0) {
428                                    query.append(WHERE_AND);
429                            }
430    
431                            for (int i = 0; i < orderByConditionFields.length; i++) {
432                                    query.append(_ORDER_BY_ENTITY_ALIAS);
433                                    query.append(orderByConditionFields[i]);
434    
435                                    if ((i + 1) < orderByConditionFields.length) {
436                                            if (orderByComparator.isAscending() ^ previous) {
437                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
438                                            }
439                                            else {
440                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
441                                            }
442                                    }
443                                    else {
444                                            if (orderByComparator.isAscending() ^ previous) {
445                                                    query.append(WHERE_GREATER_THAN);
446                                            }
447                                            else {
448                                                    query.append(WHERE_LESSER_THAN);
449                                            }
450                                    }
451                            }
452    
453                            query.append(ORDER_BY_CLAUSE);
454    
455                            String[] orderByFields = orderByComparator.getOrderByFields();
456    
457                            for (int i = 0; i < orderByFields.length; i++) {
458                                    query.append(_ORDER_BY_ENTITY_ALIAS);
459                                    query.append(orderByFields[i]);
460    
461                                    if ((i + 1) < orderByFields.length) {
462                                            if (orderByComparator.isAscending() ^ previous) {
463                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
464                                            }
465                                            else {
466                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
467                                            }
468                                    }
469                                    else {
470                                            if (orderByComparator.isAscending() ^ previous) {
471                                                    query.append(ORDER_BY_ASC);
472                                            }
473                                            else {
474                                                    query.append(ORDER_BY_DESC);
475                                            }
476                                    }
477                            }
478                    }
479                    else {
480                            query.append(ShoppingItemFieldModelImpl.ORDER_BY_JPQL);
481                    }
482    
483                    String sql = query.toString();
484    
485                    Query q = session.createQuery(sql);
486    
487                    q.setFirstResult(0);
488                    q.setMaxResults(2);
489    
490                    QueryPos qPos = QueryPos.getInstance(q);
491    
492                    qPos.add(itemId);
493    
494                    if (orderByComparator != null) {
495                            Object[] values = orderByComparator.getOrderByConditionValues(shoppingItemField);
496    
497                            for (Object value : values) {
498                                    qPos.add(value);
499                            }
500                    }
501    
502                    List<ShoppingItemField> list = q.list();
503    
504                    if (list.size() == 2) {
505                            return list.get(1);
506                    }
507                    else {
508                            return null;
509                    }
510            }
511    
512            /**
513             * Removes all the shopping item fields where itemId = &#63; from the database.
514             *
515             * @param itemId the item ID
516             * @throws SystemException if a system exception occurred
517             */
518            @Override
519            public void removeByItemId(long itemId) throws SystemException {
520                    for (ShoppingItemField shoppingItemField : findByItemId(itemId,
521                                    QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
522                            remove(shoppingItemField);
523                    }
524            }
525    
526            /**
527             * Returns the number of shopping item fields where itemId = &#63;.
528             *
529             * @param itemId the item ID
530             * @return the number of matching shopping item fields
531             * @throws SystemException if a system exception occurred
532             */
533            @Override
534            public int countByItemId(long itemId) throws SystemException {
535                    FinderPath finderPath = FINDER_PATH_COUNT_BY_ITEMID;
536    
537                    Object[] finderArgs = new Object[] { itemId };
538    
539                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
540                                    this);
541    
542                    if (count == null) {
543                            StringBundler query = new StringBundler(2);
544    
545                            query.append(_SQL_COUNT_SHOPPINGITEMFIELD_WHERE);
546    
547                            query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
548    
549                            String sql = query.toString();
550    
551                            Session session = null;
552    
553                            try {
554                                    session = openSession();
555    
556                                    Query q = session.createQuery(sql);
557    
558                                    QueryPos qPos = QueryPos.getInstance(q);
559    
560                                    qPos.add(itemId);
561    
562                                    count = (Long)q.uniqueResult();
563    
564                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
565                            }
566                            catch (Exception e) {
567                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
568    
569                                    throw processException(e);
570                            }
571                            finally {
572                                    closeSession(session);
573                            }
574                    }
575    
576                    return count.intValue();
577            }
578    
579            private static final String _FINDER_COLUMN_ITEMID_ITEMID_2 = "shoppingItemField.itemId = ?";
580    
581            public ShoppingItemFieldPersistenceImpl() {
582                    setModelClass(ShoppingItemField.class);
583            }
584    
585            /**
586             * Caches the shopping item field in the entity cache if it is enabled.
587             *
588             * @param shoppingItemField the shopping item field
589             */
590            @Override
591            public void cacheResult(ShoppingItemField shoppingItemField) {
592                    EntityCacheUtil.putResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
593                            ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey(),
594                            shoppingItemField);
595    
596                    shoppingItemField.resetOriginalValues();
597            }
598    
599            /**
600             * Caches the shopping item fields in the entity cache if it is enabled.
601             *
602             * @param shoppingItemFields the shopping item fields
603             */
604            @Override
605            public void cacheResult(List<ShoppingItemField> shoppingItemFields) {
606                    for (ShoppingItemField shoppingItemField : shoppingItemFields) {
607                            if (EntityCacheUtil.getResult(
608                                                    ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
609                                                    ShoppingItemFieldImpl.class,
610                                                    shoppingItemField.getPrimaryKey()) == null) {
611                                    cacheResult(shoppingItemField);
612                            }
613                            else {
614                                    shoppingItemField.resetOriginalValues();
615                            }
616                    }
617            }
618    
619            /**
620             * Clears the cache for all shopping item fields.
621             *
622             * <p>
623             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
624             * </p>
625             */
626            @Override
627            public void clearCache() {
628                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
629                            CacheRegistryUtil.clear(ShoppingItemFieldImpl.class.getName());
630                    }
631    
632                    EntityCacheUtil.clearCache(ShoppingItemFieldImpl.class.getName());
633    
634                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
635                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
636                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
637            }
638    
639            /**
640             * Clears the cache for the shopping item field.
641             *
642             * <p>
643             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
644             * </p>
645             */
646            @Override
647            public void clearCache(ShoppingItemField shoppingItemField) {
648                    EntityCacheUtil.removeResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
649                            ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey());
650    
651                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
652                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
653            }
654    
655            @Override
656            public void clearCache(List<ShoppingItemField> shoppingItemFields) {
657                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
658                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
659    
660                    for (ShoppingItemField shoppingItemField : shoppingItemFields) {
661                            EntityCacheUtil.removeResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
662                                    ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey());
663                    }
664            }
665    
666            /**
667             * Creates a new shopping item field with the primary key. Does not add the shopping item field to the database.
668             *
669             * @param itemFieldId the primary key for the new shopping item field
670             * @return the new shopping item field
671             */
672            @Override
673            public ShoppingItemField create(long itemFieldId) {
674                    ShoppingItemField shoppingItemField = new ShoppingItemFieldImpl();
675    
676                    shoppingItemField.setNew(true);
677                    shoppingItemField.setPrimaryKey(itemFieldId);
678    
679                    return shoppingItemField;
680            }
681    
682            /**
683             * Removes the shopping item field with the primary key from the database. Also notifies the appropriate model listeners.
684             *
685             * @param itemFieldId the primary key of the shopping item field
686             * @return the shopping item field that was removed
687             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a shopping item field with the primary key could not be found
688             * @throws SystemException if a system exception occurred
689             */
690            @Override
691            public ShoppingItemField remove(long itemFieldId)
692                    throws NoSuchItemFieldException, SystemException {
693                    return remove((Serializable)itemFieldId);
694            }
695    
696            /**
697             * Removes the shopping item field with the primary key from the database. Also notifies the appropriate model listeners.
698             *
699             * @param primaryKey the primary key of the shopping item field
700             * @return the shopping item field that was removed
701             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a shopping item field with the primary key could not be found
702             * @throws SystemException if a system exception occurred
703             */
704            @Override
705            public ShoppingItemField remove(Serializable primaryKey)
706                    throws NoSuchItemFieldException, SystemException {
707                    Session session = null;
708    
709                    try {
710                            session = openSession();
711    
712                            ShoppingItemField shoppingItemField = (ShoppingItemField)session.get(ShoppingItemFieldImpl.class,
713                                            primaryKey);
714    
715                            if (shoppingItemField == null) {
716                                    if (_log.isWarnEnabled()) {
717                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
718                                    }
719    
720                                    throw new NoSuchItemFieldException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
721                                            primaryKey);
722                            }
723    
724                            return remove(shoppingItemField);
725                    }
726                    catch (NoSuchItemFieldException nsee) {
727                            throw nsee;
728                    }
729                    catch (Exception e) {
730                            throw processException(e);
731                    }
732                    finally {
733                            closeSession(session);
734                    }
735            }
736    
737            @Override
738            protected ShoppingItemField removeImpl(ShoppingItemField shoppingItemField)
739                    throws SystemException {
740                    shoppingItemField = toUnwrappedModel(shoppingItemField);
741    
742                    Session session = null;
743    
744                    try {
745                            session = openSession();
746    
747                            if (!session.contains(shoppingItemField)) {
748                                    shoppingItemField = (ShoppingItemField)session.get(ShoppingItemFieldImpl.class,
749                                                    shoppingItemField.getPrimaryKeyObj());
750                            }
751    
752                            if (shoppingItemField != null) {
753                                    session.delete(shoppingItemField);
754                            }
755                    }
756                    catch (Exception e) {
757                            throw processException(e);
758                    }
759                    finally {
760                            closeSession(session);
761                    }
762    
763                    if (shoppingItemField != null) {
764                            clearCache(shoppingItemField);
765                    }
766    
767                    return shoppingItemField;
768            }
769    
770            @Override
771            public ShoppingItemField updateImpl(
772                    com.liferay.portlet.shopping.model.ShoppingItemField shoppingItemField)
773                    throws SystemException {
774                    shoppingItemField = toUnwrappedModel(shoppingItemField);
775    
776                    boolean isNew = shoppingItemField.isNew();
777    
778                    ShoppingItemFieldModelImpl shoppingItemFieldModelImpl = (ShoppingItemFieldModelImpl)shoppingItemField;
779    
780                    Session session = null;
781    
782                    try {
783                            session = openSession();
784    
785                            if (shoppingItemField.isNew()) {
786                                    session.save(shoppingItemField);
787    
788                                    shoppingItemField.setNew(false);
789                            }
790                            else {
791                                    session.merge(shoppingItemField);
792                            }
793                    }
794                    catch (Exception e) {
795                            throw processException(e);
796                    }
797                    finally {
798                            closeSession(session);
799                    }
800    
801                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
802    
803                    if (isNew || !ShoppingItemFieldModelImpl.COLUMN_BITMASK_ENABLED) {
804                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
805                    }
806    
807                    else {
808                            if ((shoppingItemFieldModelImpl.getColumnBitmask() &
809                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID.getColumnBitmask()) != 0) {
810                                    Object[] args = new Object[] {
811                                                    shoppingItemFieldModelImpl.getOriginalItemId()
812                                            };
813    
814                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ITEMID, args);
815                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID,
816                                            args);
817    
818                                    args = new Object[] { shoppingItemFieldModelImpl.getItemId() };
819    
820                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ITEMID, args);
821                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID,
822                                            args);
823                            }
824                    }
825    
826                    EntityCacheUtil.putResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
827                            ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey(),
828                            shoppingItemField);
829    
830                    return shoppingItemField;
831            }
832    
833            protected ShoppingItemField toUnwrappedModel(
834                    ShoppingItemField shoppingItemField) {
835                    if (shoppingItemField instanceof ShoppingItemFieldImpl) {
836                            return shoppingItemField;
837                    }
838    
839                    ShoppingItemFieldImpl shoppingItemFieldImpl = new ShoppingItemFieldImpl();
840    
841                    shoppingItemFieldImpl.setNew(shoppingItemField.isNew());
842                    shoppingItemFieldImpl.setPrimaryKey(shoppingItemField.getPrimaryKey());
843    
844                    shoppingItemFieldImpl.setItemFieldId(shoppingItemField.getItemFieldId());
845                    shoppingItemFieldImpl.setItemId(shoppingItemField.getItemId());
846                    shoppingItemFieldImpl.setName(shoppingItemField.getName());
847                    shoppingItemFieldImpl.setValues(shoppingItemField.getValues());
848                    shoppingItemFieldImpl.setDescription(shoppingItemField.getDescription());
849    
850                    return shoppingItemFieldImpl;
851            }
852    
853            /**
854             * Returns the shopping item field with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
855             *
856             * @param primaryKey the primary key of the shopping item field
857             * @return the shopping item field
858             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a shopping item field with the primary key could not be found
859             * @throws SystemException if a system exception occurred
860             */
861            @Override
862            public ShoppingItemField findByPrimaryKey(Serializable primaryKey)
863                    throws NoSuchItemFieldException, SystemException {
864                    ShoppingItemField shoppingItemField = fetchByPrimaryKey(primaryKey);
865    
866                    if (shoppingItemField == null) {
867                            if (_log.isWarnEnabled()) {
868                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
869                            }
870    
871                            throw new NoSuchItemFieldException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
872                                    primaryKey);
873                    }
874    
875                    return shoppingItemField;
876            }
877    
878            /**
879             * Returns the shopping item field with the primary key or throws a {@link com.liferay.portlet.shopping.NoSuchItemFieldException} if it could not be found.
880             *
881             * @param itemFieldId the primary key of the shopping item field
882             * @return the shopping item field
883             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a shopping item field with the primary key could not be found
884             * @throws SystemException if a system exception occurred
885             */
886            @Override
887            public ShoppingItemField findByPrimaryKey(long itemFieldId)
888                    throws NoSuchItemFieldException, SystemException {
889                    return findByPrimaryKey((Serializable)itemFieldId);
890            }
891    
892            /**
893             * Returns the shopping item field with the primary key or returns <code>null</code> if it could not be found.
894             *
895             * @param primaryKey the primary key of the shopping item field
896             * @return the shopping item field, or <code>null</code> if a shopping item field with the primary key could not be found
897             * @throws SystemException if a system exception occurred
898             */
899            @Override
900            public ShoppingItemField fetchByPrimaryKey(Serializable primaryKey)
901                    throws SystemException {
902                    ShoppingItemField shoppingItemField = (ShoppingItemField)EntityCacheUtil.getResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
903                                    ShoppingItemFieldImpl.class, primaryKey);
904    
905                    if (shoppingItemField == _nullShoppingItemField) {
906                            return null;
907                    }
908    
909                    if (shoppingItemField == null) {
910                            Session session = null;
911    
912                            try {
913                                    session = openSession();
914    
915                                    shoppingItemField = (ShoppingItemField)session.get(ShoppingItemFieldImpl.class,
916                                                    primaryKey);
917    
918                                    if (shoppingItemField != null) {
919                                            cacheResult(shoppingItemField);
920                                    }
921                                    else {
922                                            EntityCacheUtil.putResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
923                                                    ShoppingItemFieldImpl.class, primaryKey,
924                                                    _nullShoppingItemField);
925                                    }
926                            }
927                            catch (Exception e) {
928                                    EntityCacheUtil.removeResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
929                                            ShoppingItemFieldImpl.class, primaryKey);
930    
931                                    throw processException(e);
932                            }
933                            finally {
934                                    closeSession(session);
935                            }
936                    }
937    
938                    return shoppingItemField;
939            }
940    
941            /**
942             * Returns the shopping item field with the primary key or returns <code>null</code> if it could not be found.
943             *
944             * @param itemFieldId the primary key of the shopping item field
945             * @return the shopping item field, or <code>null</code> if a shopping item field with the primary key could not be found
946             * @throws SystemException if a system exception occurred
947             */
948            @Override
949            public ShoppingItemField fetchByPrimaryKey(long itemFieldId)
950                    throws SystemException {
951                    return fetchByPrimaryKey((Serializable)itemFieldId);
952            }
953    
954            /**
955             * Returns all the shopping item fields.
956             *
957             * @return the shopping item fields
958             * @throws SystemException if a system exception occurred
959             */
960            @Override
961            public List<ShoppingItemField> findAll() throws SystemException {
962                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
963            }
964    
965            /**
966             * Returns a range of all the shopping item fields.
967             *
968             * <p>
969             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.shopping.model.impl.ShoppingItemFieldModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
970             * </p>
971             *
972             * @param start the lower bound of the range of shopping item fields
973             * @param end the upper bound of the range of shopping item fields (not inclusive)
974             * @return the range of shopping item fields
975             * @throws SystemException if a system exception occurred
976             */
977            @Override
978            public List<ShoppingItemField> findAll(int start, int end)
979                    throws SystemException {
980                    return findAll(start, end, null);
981            }
982    
983            /**
984             * Returns an ordered range of all the shopping item fields.
985             *
986             * <p>
987             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.shopping.model.impl.ShoppingItemFieldModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
988             * </p>
989             *
990             * @param start the lower bound of the range of shopping item fields
991             * @param end the upper bound of the range of shopping item fields (not inclusive)
992             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
993             * @return the ordered range of shopping item fields
994             * @throws SystemException if a system exception occurred
995             */
996            @Override
997            public List<ShoppingItemField> findAll(int start, int end,
998                    OrderByComparator orderByComparator) throws SystemException {
999                    boolean pagination = true;
1000                    FinderPath finderPath = null;
1001                    Object[] finderArgs = null;
1002    
1003                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1004                                    (orderByComparator == null)) {
1005                            pagination = false;
1006                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1007                            finderArgs = FINDER_ARGS_EMPTY;
1008                    }
1009                    else {
1010                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1011                            finderArgs = new Object[] { start, end, orderByComparator };
1012                    }
1013    
1014                    List<ShoppingItemField> list = (List<ShoppingItemField>)FinderCacheUtil.getResult(finderPath,
1015                                    finderArgs, this);
1016    
1017                    if (list == null) {
1018                            StringBundler query = null;
1019                            String sql = null;
1020    
1021                            if (orderByComparator != null) {
1022                                    query = new StringBundler(2 +
1023                                                    (orderByComparator.getOrderByFields().length * 3));
1024    
1025                                    query.append(_SQL_SELECT_SHOPPINGITEMFIELD);
1026    
1027                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1028                                            orderByComparator);
1029    
1030                                    sql = query.toString();
1031                            }
1032                            else {
1033                                    sql = _SQL_SELECT_SHOPPINGITEMFIELD;
1034    
1035                                    if (pagination) {
1036                                            sql = sql.concat(ShoppingItemFieldModelImpl.ORDER_BY_JPQL);
1037                                    }
1038                            }
1039    
1040                            Session session = null;
1041    
1042                            try {
1043                                    session = openSession();
1044    
1045                                    Query q = session.createQuery(sql);
1046    
1047                                    if (!pagination) {
1048                                            list = (List<ShoppingItemField>)QueryUtil.list(q,
1049                                                            getDialect(), start, end, false);
1050    
1051                                            Collections.sort(list);
1052    
1053                                            list = new UnmodifiableList<ShoppingItemField>(list);
1054                                    }
1055                                    else {
1056                                            list = (List<ShoppingItemField>)QueryUtil.list(q,
1057                                                            getDialect(), start, end);
1058                                    }
1059    
1060                                    cacheResult(list);
1061    
1062                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
1063                            }
1064                            catch (Exception e) {
1065                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1066    
1067                                    throw processException(e);
1068                            }
1069                            finally {
1070                                    closeSession(session);
1071                            }
1072                    }
1073    
1074                    return list;
1075            }
1076    
1077            /**
1078             * Removes all the shopping item fields from the database.
1079             *
1080             * @throws SystemException if a system exception occurred
1081             */
1082            @Override
1083            public void removeAll() throws SystemException {
1084                    for (ShoppingItemField shoppingItemField : findAll()) {
1085                            remove(shoppingItemField);
1086                    }
1087            }
1088    
1089            /**
1090             * Returns the number of shopping item fields.
1091             *
1092             * @return the number of shopping item fields
1093             * @throws SystemException if a system exception occurred
1094             */
1095            @Override
1096            public int countAll() throws SystemException {
1097                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1098                                    FINDER_ARGS_EMPTY, this);
1099    
1100                    if (count == null) {
1101                            Session session = null;
1102    
1103                            try {
1104                                    session = openSession();
1105    
1106                                    Query q = session.createQuery(_SQL_COUNT_SHOPPINGITEMFIELD);
1107    
1108                                    count = (Long)q.uniqueResult();
1109    
1110                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1111                                            FINDER_ARGS_EMPTY, count);
1112                            }
1113                            catch (Exception e) {
1114                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
1115                                            FINDER_ARGS_EMPTY);
1116    
1117                                    throw processException(e);
1118                            }
1119                            finally {
1120                                    closeSession(session);
1121                            }
1122                    }
1123    
1124                    return count.intValue();
1125            }
1126    
1127            @Override
1128            protected Set<String> getBadColumnNames() {
1129                    return _badColumnNames;
1130            }
1131    
1132            /**
1133             * Initializes the shopping item field persistence.
1134             */
1135            public void afterPropertiesSet() {
1136                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1137                                            com.liferay.portal.util.PropsUtil.get(
1138                                                    "value.object.listener.com.liferay.portlet.shopping.model.ShoppingItemField")));
1139    
1140                    if (listenerClassNames.length > 0) {
1141                            try {
1142                                    List<ModelListener<ShoppingItemField>> listenersList = new ArrayList<ModelListener<ShoppingItemField>>();
1143    
1144                                    for (String listenerClassName : listenerClassNames) {
1145                                            listenersList.add((ModelListener<ShoppingItemField>)InstanceFactory.newInstance(
1146                                                            getClassLoader(), listenerClassName));
1147                                    }
1148    
1149                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1150                            }
1151                            catch (Exception e) {
1152                                    _log.error(e);
1153                            }
1154                    }
1155            }
1156    
1157            public void destroy() {
1158                    EntityCacheUtil.removeCache(ShoppingItemFieldImpl.class.getName());
1159                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1160                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1161                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1162            }
1163    
1164            private static final String _SQL_SELECT_SHOPPINGITEMFIELD = "SELECT shoppingItemField FROM ShoppingItemField shoppingItemField";
1165            private static final String _SQL_SELECT_SHOPPINGITEMFIELD_WHERE = "SELECT shoppingItemField FROM ShoppingItemField shoppingItemField WHERE ";
1166            private static final String _SQL_COUNT_SHOPPINGITEMFIELD = "SELECT COUNT(shoppingItemField) FROM ShoppingItemField shoppingItemField";
1167            private static final String _SQL_COUNT_SHOPPINGITEMFIELD_WHERE = "SELECT COUNT(shoppingItemField) FROM ShoppingItemField shoppingItemField WHERE ";
1168            private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingItemField.";
1169            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingItemField exists with the primary key ";
1170            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingItemField exists with the key {";
1171            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1172            private static Log _log = LogFactoryUtil.getLog(ShoppingItemFieldPersistenceImpl.class);
1173            private static Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
1174                                    "values"
1175                            });
1176            private static ShoppingItemField _nullShoppingItemField = new ShoppingItemFieldImpl() {
1177                            @Override
1178                            public Object clone() {
1179                                    return this;
1180                            }
1181    
1182                            @Override
1183                            public CacheModel<ShoppingItemField> toCacheModel() {
1184                                    return _nullShoppingItemFieldCacheModel;
1185                            }
1186                    };
1187    
1188            private static CacheModel<ShoppingItemField> _nullShoppingItemFieldCacheModel =
1189                    new CacheModel<ShoppingItemField>() {
1190                            @Override
1191                            public ShoppingItemField toEntityModel() {
1192                                    return _nullShoppingItemField;
1193                            }
1194                    };
1195    }