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            /**
582             * Caches the shopping item field in the entity cache if it is enabled.
583             *
584             * @param shoppingItemField the shopping item field
585             */
586            @Override
587            public void cacheResult(ShoppingItemField shoppingItemField) {
588                    EntityCacheUtil.putResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
589                            ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey(),
590                            shoppingItemField);
591    
592                    shoppingItemField.resetOriginalValues();
593            }
594    
595            /**
596             * Caches the shopping item fields in the entity cache if it is enabled.
597             *
598             * @param shoppingItemFields the shopping item fields
599             */
600            @Override
601            public void cacheResult(List<ShoppingItemField> shoppingItemFields) {
602                    for (ShoppingItemField shoppingItemField : shoppingItemFields) {
603                            if (EntityCacheUtil.getResult(
604                                                    ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
605                                                    ShoppingItemFieldImpl.class,
606                                                    shoppingItemField.getPrimaryKey()) == null) {
607                                    cacheResult(shoppingItemField);
608                            }
609                            else {
610                                    shoppingItemField.resetOriginalValues();
611                            }
612                    }
613            }
614    
615            /**
616             * Clears the cache for all shopping item fields.
617             *
618             * <p>
619             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
620             * </p>
621             */
622            @Override
623            public void clearCache() {
624                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
625                            CacheRegistryUtil.clear(ShoppingItemFieldImpl.class.getName());
626                    }
627    
628                    EntityCacheUtil.clearCache(ShoppingItemFieldImpl.class.getName());
629    
630                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
631                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
632                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
633            }
634    
635            /**
636             * Clears the cache for the shopping item field.
637             *
638             * <p>
639             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
640             * </p>
641             */
642            @Override
643            public void clearCache(ShoppingItemField shoppingItemField) {
644                    EntityCacheUtil.removeResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
645                            ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey());
646    
647                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
648                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
649            }
650    
651            @Override
652            public void clearCache(List<ShoppingItemField> shoppingItemFields) {
653                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
654                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
655    
656                    for (ShoppingItemField shoppingItemField : shoppingItemFields) {
657                            EntityCacheUtil.removeResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
658                                    ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey());
659                    }
660            }
661    
662            /**
663             * Creates a new shopping item field with the primary key. Does not add the shopping item field to the database.
664             *
665             * @param itemFieldId the primary key for the new shopping item field
666             * @return the new shopping item field
667             */
668            @Override
669            public ShoppingItemField create(long itemFieldId) {
670                    ShoppingItemField shoppingItemField = new ShoppingItemFieldImpl();
671    
672                    shoppingItemField.setNew(true);
673                    shoppingItemField.setPrimaryKey(itemFieldId);
674    
675                    return shoppingItemField;
676            }
677    
678            /**
679             * Removes the shopping item field with the primary key from the database. Also notifies the appropriate model listeners.
680             *
681             * @param itemFieldId the primary key of the shopping item field
682             * @return the shopping item field that was removed
683             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a shopping item field with the primary key could not be found
684             * @throws SystemException if a system exception occurred
685             */
686            @Override
687            public ShoppingItemField remove(long itemFieldId)
688                    throws NoSuchItemFieldException, SystemException {
689                    return remove((Serializable)itemFieldId);
690            }
691    
692            /**
693             * Removes the shopping item field with the primary key from the database. Also notifies the appropriate model listeners.
694             *
695             * @param primaryKey the primary key of the shopping item field
696             * @return the shopping item field that was removed
697             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a shopping item field with the primary key could not be found
698             * @throws SystemException if a system exception occurred
699             */
700            @Override
701            public ShoppingItemField remove(Serializable primaryKey)
702                    throws NoSuchItemFieldException, SystemException {
703                    Session session = null;
704    
705                    try {
706                            session = openSession();
707    
708                            ShoppingItemField shoppingItemField = (ShoppingItemField)session.get(ShoppingItemFieldImpl.class,
709                                            primaryKey);
710    
711                            if (shoppingItemField == null) {
712                                    if (_log.isWarnEnabled()) {
713                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
714                                    }
715    
716                                    throw new NoSuchItemFieldException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
717                                            primaryKey);
718                            }
719    
720                            return remove(shoppingItemField);
721                    }
722                    catch (NoSuchItemFieldException nsee) {
723                            throw nsee;
724                    }
725                    catch (Exception e) {
726                            throw processException(e);
727                    }
728                    finally {
729                            closeSession(session);
730                    }
731            }
732    
733            @Override
734            protected ShoppingItemField removeImpl(ShoppingItemField shoppingItemField)
735                    throws SystemException {
736                    shoppingItemField = toUnwrappedModel(shoppingItemField);
737    
738                    Session session = null;
739    
740                    try {
741                            session = openSession();
742    
743                            if (!session.contains(shoppingItemField)) {
744                                    shoppingItemField = (ShoppingItemField)session.get(ShoppingItemFieldImpl.class,
745                                                    shoppingItemField.getPrimaryKeyObj());
746                            }
747    
748                            if (shoppingItemField != null) {
749                                    session.delete(shoppingItemField);
750                            }
751                    }
752                    catch (Exception e) {
753                            throw processException(e);
754                    }
755                    finally {
756                            closeSession(session);
757                    }
758    
759                    if (shoppingItemField != null) {
760                            clearCache(shoppingItemField);
761                    }
762    
763                    return shoppingItemField;
764            }
765    
766            @Override
767            public ShoppingItemField updateImpl(
768                    com.liferay.portlet.shopping.model.ShoppingItemField shoppingItemField)
769                    throws SystemException {
770                    shoppingItemField = toUnwrappedModel(shoppingItemField);
771    
772                    boolean isNew = shoppingItemField.isNew();
773    
774                    ShoppingItemFieldModelImpl shoppingItemFieldModelImpl = (ShoppingItemFieldModelImpl)shoppingItemField;
775    
776                    Session session = null;
777    
778                    try {
779                            session = openSession();
780    
781                            if (shoppingItemField.isNew()) {
782                                    session.save(shoppingItemField);
783    
784                                    shoppingItemField.setNew(false);
785                            }
786                            else {
787                                    session.merge(shoppingItemField);
788                            }
789                    }
790                    catch (Exception e) {
791                            throw processException(e);
792                    }
793                    finally {
794                            closeSession(session);
795                    }
796    
797                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
798    
799                    if (isNew || !ShoppingItemFieldModelImpl.COLUMN_BITMASK_ENABLED) {
800                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
801                    }
802    
803                    else {
804                            if ((shoppingItemFieldModelImpl.getColumnBitmask() &
805                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID.getColumnBitmask()) != 0) {
806                                    Object[] args = new Object[] {
807                                                    shoppingItemFieldModelImpl.getOriginalItemId()
808                                            };
809    
810                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ITEMID, args);
811                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID,
812                                            args);
813    
814                                    args = new Object[] { shoppingItemFieldModelImpl.getItemId() };
815    
816                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ITEMID, args);
817                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID,
818                                            args);
819                            }
820                    }
821    
822                    EntityCacheUtil.putResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
823                            ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey(),
824                            shoppingItemField);
825    
826                    return shoppingItemField;
827            }
828    
829            protected ShoppingItemField toUnwrappedModel(
830                    ShoppingItemField shoppingItemField) {
831                    if (shoppingItemField instanceof ShoppingItemFieldImpl) {
832                            return shoppingItemField;
833                    }
834    
835                    ShoppingItemFieldImpl shoppingItemFieldImpl = new ShoppingItemFieldImpl();
836    
837                    shoppingItemFieldImpl.setNew(shoppingItemField.isNew());
838                    shoppingItemFieldImpl.setPrimaryKey(shoppingItemField.getPrimaryKey());
839    
840                    shoppingItemFieldImpl.setItemFieldId(shoppingItemField.getItemFieldId());
841                    shoppingItemFieldImpl.setItemId(shoppingItemField.getItemId());
842                    shoppingItemFieldImpl.setName(shoppingItemField.getName());
843                    shoppingItemFieldImpl.setValues(shoppingItemField.getValues());
844                    shoppingItemFieldImpl.setDescription(shoppingItemField.getDescription());
845    
846                    return shoppingItemFieldImpl;
847            }
848    
849            /**
850             * Returns the shopping item field with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
851             *
852             * @param primaryKey the primary key of the shopping item field
853             * @return the shopping item field
854             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a shopping item field with the primary key could not be found
855             * @throws SystemException if a system exception occurred
856             */
857            @Override
858            public ShoppingItemField findByPrimaryKey(Serializable primaryKey)
859                    throws NoSuchItemFieldException, SystemException {
860                    ShoppingItemField shoppingItemField = fetchByPrimaryKey(primaryKey);
861    
862                    if (shoppingItemField == null) {
863                            if (_log.isWarnEnabled()) {
864                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
865                            }
866    
867                            throw new NoSuchItemFieldException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
868                                    primaryKey);
869                    }
870    
871                    return shoppingItemField;
872            }
873    
874            /**
875             * Returns the shopping item field with the primary key or throws a {@link com.liferay.portlet.shopping.NoSuchItemFieldException} if it could not be found.
876             *
877             * @param itemFieldId the primary key of the shopping item field
878             * @return the shopping item field
879             * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a shopping item field with the primary key could not be found
880             * @throws SystemException if a system exception occurred
881             */
882            @Override
883            public ShoppingItemField findByPrimaryKey(long itemFieldId)
884                    throws NoSuchItemFieldException, SystemException {
885                    return findByPrimaryKey((Serializable)itemFieldId);
886            }
887    
888            /**
889             * Returns the shopping item field with the primary key or returns <code>null</code> if it could not be found.
890             *
891             * @param primaryKey the primary key of the shopping item field
892             * @return the shopping item field, or <code>null</code> if a shopping item field with the primary key could not be found
893             * @throws SystemException if a system exception occurred
894             */
895            @Override
896            public ShoppingItemField fetchByPrimaryKey(Serializable primaryKey)
897                    throws SystemException {
898                    ShoppingItemField shoppingItemField = (ShoppingItemField)EntityCacheUtil.getResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
899                                    ShoppingItemFieldImpl.class, primaryKey);
900    
901                    if (shoppingItemField == _nullShoppingItemField) {
902                            return null;
903                    }
904    
905                    if (shoppingItemField == null) {
906                            Session session = null;
907    
908                            try {
909                                    session = openSession();
910    
911                                    shoppingItemField = (ShoppingItemField)session.get(ShoppingItemFieldImpl.class,
912                                                    primaryKey);
913    
914                                    if (shoppingItemField != null) {
915                                            cacheResult(shoppingItemField);
916                                    }
917                                    else {
918                                            EntityCacheUtil.putResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
919                                                    ShoppingItemFieldImpl.class, primaryKey,
920                                                    _nullShoppingItemField);
921                                    }
922                            }
923                            catch (Exception e) {
924                                    EntityCacheUtil.removeResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
925                                            ShoppingItemFieldImpl.class, primaryKey);
926    
927                                    throw processException(e);
928                            }
929                            finally {
930                                    closeSession(session);
931                            }
932                    }
933    
934                    return shoppingItemField;
935            }
936    
937            /**
938             * Returns the shopping item field with the primary key or returns <code>null</code> if it could not be found.
939             *
940             * @param itemFieldId the primary key of the shopping item field
941             * @return the shopping item field, or <code>null</code> if a shopping item field with the primary key could not be found
942             * @throws SystemException if a system exception occurred
943             */
944            @Override
945            public ShoppingItemField fetchByPrimaryKey(long itemFieldId)
946                    throws SystemException {
947                    return fetchByPrimaryKey((Serializable)itemFieldId);
948            }
949    
950            /**
951             * Returns all the shopping item fields.
952             *
953             * @return the shopping item fields
954             * @throws SystemException if a system exception occurred
955             */
956            @Override
957            public List<ShoppingItemField> findAll() throws SystemException {
958                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
959            }
960    
961            /**
962             * Returns a range of all the shopping item fields.
963             *
964             * <p>
965             * 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.
966             * </p>
967             *
968             * @param start the lower bound of the range of shopping item fields
969             * @param end the upper bound of the range of shopping item fields (not inclusive)
970             * @return the range of shopping item fields
971             * @throws SystemException if a system exception occurred
972             */
973            @Override
974            public List<ShoppingItemField> findAll(int start, int end)
975                    throws SystemException {
976                    return findAll(start, end, null);
977            }
978    
979            /**
980             * Returns an ordered range of all the shopping item fields.
981             *
982             * <p>
983             * 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.
984             * </p>
985             *
986             * @param start the lower bound of the range of shopping item fields
987             * @param end the upper bound of the range of shopping item fields (not inclusive)
988             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
989             * @return the ordered range of shopping item fields
990             * @throws SystemException if a system exception occurred
991             */
992            @Override
993            public List<ShoppingItemField> findAll(int start, int end,
994                    OrderByComparator orderByComparator) throws SystemException {
995                    boolean pagination = true;
996                    FinderPath finderPath = null;
997                    Object[] finderArgs = null;
998    
999                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1000                                    (orderByComparator == null)) {
1001                            pagination = false;
1002                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1003                            finderArgs = FINDER_ARGS_EMPTY;
1004                    }
1005                    else {
1006                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1007                            finderArgs = new Object[] { start, end, orderByComparator };
1008                    }
1009    
1010                    List<ShoppingItemField> list = (List<ShoppingItemField>)FinderCacheUtil.getResult(finderPath,
1011                                    finderArgs, this);
1012    
1013                    if (list == null) {
1014                            StringBundler query = null;
1015                            String sql = null;
1016    
1017                            if (orderByComparator != null) {
1018                                    query = new StringBundler(2 +
1019                                                    (orderByComparator.getOrderByFields().length * 3));
1020    
1021                                    query.append(_SQL_SELECT_SHOPPINGITEMFIELD);
1022    
1023                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1024                                            orderByComparator);
1025    
1026                                    sql = query.toString();
1027                            }
1028                            else {
1029                                    sql = _SQL_SELECT_SHOPPINGITEMFIELD;
1030    
1031                                    if (pagination) {
1032                                            sql = sql.concat(ShoppingItemFieldModelImpl.ORDER_BY_JPQL);
1033                                    }
1034                            }
1035    
1036                            Session session = null;
1037    
1038                            try {
1039                                    session = openSession();
1040    
1041                                    Query q = session.createQuery(sql);
1042    
1043                                    if (!pagination) {
1044                                            list = (List<ShoppingItemField>)QueryUtil.list(q,
1045                                                            getDialect(), start, end, false);
1046    
1047                                            Collections.sort(list);
1048    
1049                                            list = new UnmodifiableList<ShoppingItemField>(list);
1050                                    }
1051                                    else {
1052                                            list = (List<ShoppingItemField>)QueryUtil.list(q,
1053                                                            getDialect(), start, end);
1054                                    }
1055    
1056                                    cacheResult(list);
1057    
1058                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
1059                            }
1060                            catch (Exception e) {
1061                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1062    
1063                                    throw processException(e);
1064                            }
1065                            finally {
1066                                    closeSession(session);
1067                            }
1068                    }
1069    
1070                    return list;
1071            }
1072    
1073            /**
1074             * Removes all the shopping item fields from the database.
1075             *
1076             * @throws SystemException if a system exception occurred
1077             */
1078            @Override
1079            public void removeAll() throws SystemException {
1080                    for (ShoppingItemField shoppingItemField : findAll()) {
1081                            remove(shoppingItemField);
1082                    }
1083            }
1084    
1085            /**
1086             * Returns the number of shopping item fields.
1087             *
1088             * @return the number of shopping item fields
1089             * @throws SystemException if a system exception occurred
1090             */
1091            @Override
1092            public int countAll() throws SystemException {
1093                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1094                                    FINDER_ARGS_EMPTY, this);
1095    
1096                    if (count == null) {
1097                            Session session = null;
1098    
1099                            try {
1100                                    session = openSession();
1101    
1102                                    Query q = session.createQuery(_SQL_COUNT_SHOPPINGITEMFIELD);
1103    
1104                                    count = (Long)q.uniqueResult();
1105    
1106                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1107                                            FINDER_ARGS_EMPTY, count);
1108                            }
1109                            catch (Exception e) {
1110                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
1111                                            FINDER_ARGS_EMPTY);
1112    
1113                                    throw processException(e);
1114                            }
1115                            finally {
1116                                    closeSession(session);
1117                            }
1118                    }
1119    
1120                    return count.intValue();
1121            }
1122    
1123            @Override
1124            protected Set<String> getBadColumnNames() {
1125                    return _badColumnNames;
1126            }
1127    
1128            /**
1129             * Initializes the shopping item field persistence.
1130             */
1131            public void afterPropertiesSet() {
1132                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1133                                            com.liferay.portal.util.PropsUtil.get(
1134                                                    "value.object.listener.com.liferay.portlet.shopping.model.ShoppingItemField")));
1135    
1136                    if (listenerClassNames.length > 0) {
1137                            try {
1138                                    List<ModelListener<ShoppingItemField>> listenersList = new ArrayList<ModelListener<ShoppingItemField>>();
1139    
1140                                    for (String listenerClassName : listenerClassNames) {
1141                                            listenersList.add((ModelListener<ShoppingItemField>)InstanceFactory.newInstance(
1142                                                            getClassLoader(), listenerClassName));
1143                                    }
1144    
1145                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1146                            }
1147                            catch (Exception e) {
1148                                    _log.error(e);
1149                            }
1150                    }
1151            }
1152    
1153            public void destroy() {
1154                    EntityCacheUtil.removeCache(ShoppingItemFieldImpl.class.getName());
1155                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1156                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1157                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1158            }
1159    
1160            private static final String _SQL_SELECT_SHOPPINGITEMFIELD = "SELECT shoppingItemField FROM ShoppingItemField shoppingItemField";
1161            private static final String _SQL_SELECT_SHOPPINGITEMFIELD_WHERE = "SELECT shoppingItemField FROM ShoppingItemField shoppingItemField WHERE ";
1162            private static final String _SQL_COUNT_SHOPPINGITEMFIELD = "SELECT COUNT(shoppingItemField) FROM ShoppingItemField shoppingItemField";
1163            private static final String _SQL_COUNT_SHOPPINGITEMFIELD_WHERE = "SELECT COUNT(shoppingItemField) FROM ShoppingItemField shoppingItemField WHERE ";
1164            private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingItemField.";
1165            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingItemField exists with the primary key ";
1166            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingItemField exists with the key {";
1167            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1168            private static Log _log = LogFactoryUtil.getLog(ShoppingItemFieldPersistenceImpl.class);
1169            private static Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
1170                                    "values"
1171                            });
1172            private static ShoppingItemField _nullShoppingItemField = new ShoppingItemFieldImpl() {
1173                            @Override
1174                            public Object clone() {
1175                                    return this;
1176                            }
1177    
1178                            @Override
1179                            public CacheModel<ShoppingItemField> toCacheModel() {
1180                                    return _nullShoppingItemFieldCacheModel;
1181                            }
1182                    };
1183    
1184            private static CacheModel<ShoppingItemField> _nullShoppingItemFieldCacheModel =
1185                    new CacheModel<ShoppingItemField>() {
1186                            @Override
1187                            public ShoppingItemField toEntityModel() {
1188                                    return _nullShoppingItemField;
1189                            }
1190                    };
1191    }