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