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