001    /**
002     * Copyright (c) 2000-present 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.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
020    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
021    import com.liferay.portal.kernel.dao.orm.FinderPath;
022    import com.liferay.portal.kernel.dao.orm.Query;
023    import com.liferay.portal.kernel.dao.orm.QueryPos;
024    import com.liferay.portal.kernel.dao.orm.QueryUtil;
025    import com.liferay.portal.kernel.dao.orm.Session;
026    import com.liferay.portal.kernel.log.Log;
027    import com.liferay.portal.kernel.log.LogFactoryUtil;
028    import com.liferay.portal.kernel.util.OrderByComparator;
029    import com.liferay.portal.kernel.util.SetUtil;
030    import com.liferay.portal.kernel.util.StringBundler;
031    import com.liferay.portal.kernel.util.StringPool;
032    import com.liferay.portal.model.CacheModel;
033    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
034    
035    import com.liferay.portlet.shopping.NoSuchItemFieldException;
036    import com.liferay.portlet.shopping.model.ShoppingItemField;
037    import com.liferay.portlet.shopping.model.impl.ShoppingItemFieldImpl;
038    import com.liferay.portlet.shopping.model.impl.ShoppingItemFieldModelImpl;
039    import com.liferay.portlet.shopping.service.persistence.ShoppingItemFieldPersistence;
040    
041    import java.io.Serializable;
042    
043    import java.util.Collections;
044    import java.util.HashMap;
045    import java.util.HashSet;
046    import java.util.Iterator;
047    import java.util.List;
048    import java.util.Map;
049    import java.util.Set;
050    
051    /**
052     * The persistence implementation for the shopping item field service.
053     *
054     * <p>
055     * Caching information and settings can be found in <code>portal.properties</code>
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see ShoppingItemFieldPersistence
060     * @see com.liferay.portlet.shopping.service.persistence.ShoppingItemFieldUtil
061     * @generated
062     */
063    @ProviderType
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             */
116            @Override
117            public List<ShoppingItemField> findByItemId(long itemId) {
118                    return findByItemId(itemId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
119            }
120    
121            /**
122             * Returns a range of all the shopping item fields where itemId = &#63;.
123             *
124             * <p>
125             * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link 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.
126             * </p>
127             *
128             * @param itemId the item ID
129             * @param start the lower bound of the range of shopping item fields
130             * @param end the upper bound of the range of shopping item fields (not inclusive)
131             * @return the range of matching shopping item fields
132             */
133            @Override
134            public List<ShoppingItemField> findByItemId(long itemId, int start, int end) {
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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link 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             */
151            @Override
152            public List<ShoppingItemField> findByItemId(long itemId, int start,
153                    int end, OrderByComparator<ShoppingItemField> orderByComparator) {
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 = Collections.unmodifiableList(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 NoSuchItemFieldException if a matching shopping item field could not be found
256             */
257            @Override
258            public ShoppingItemField findByItemId_First(long itemId,
259                    OrderByComparator<ShoppingItemField> orderByComparator)
260                    throws NoSuchItemFieldException {
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             */
287            @Override
288            public ShoppingItemField fetchByItemId_First(long itemId,
289                    OrderByComparator<ShoppingItemField> orderByComparator) {
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 NoSuchItemFieldException if a matching shopping item field could not be found
307             */
308            @Override
309            public ShoppingItemField findByItemId_Last(long itemId,
310                    OrderByComparator<ShoppingItemField> orderByComparator)
311                    throws NoSuchItemFieldException {
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             */
338            @Override
339            public ShoppingItemField fetchByItemId_Last(long itemId,
340                    OrderByComparator<ShoppingItemField> orderByComparator) {
341                    int count = countByItemId(itemId);
342    
343                    if (count == 0) {
344                            return null;
345                    }
346    
347                    List<ShoppingItemField> list = findByItemId(itemId, count - 1, count,
348                                    orderByComparator);
349    
350                    if (!list.isEmpty()) {
351                            return list.get(0);
352                    }
353    
354                    return null;
355            }
356    
357            /**
358             * Returns the shopping item fields before and after the current shopping item field in the ordered set where itemId = &#63;.
359             *
360             * @param itemFieldId the primary key of the current shopping item field
361             * @param itemId the item ID
362             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
363             * @return the previous, current, and next shopping item field
364             * @throws NoSuchItemFieldException if a shopping item field with the primary key could not be found
365             */
366            @Override
367            public ShoppingItemField[] findByItemId_PrevAndNext(long itemFieldId,
368                    long itemId, OrderByComparator<ShoppingItemField> orderByComparator)
369                    throws NoSuchItemFieldException {
370                    ShoppingItemField shoppingItemField = findByPrimaryKey(itemFieldId);
371    
372                    Session session = null;
373    
374                    try {
375                            session = openSession();
376    
377                            ShoppingItemField[] array = new ShoppingItemFieldImpl[3];
378    
379                            array[0] = getByItemId_PrevAndNext(session, shoppingItemField,
380                                            itemId, orderByComparator, true);
381    
382                            array[1] = shoppingItemField;
383    
384                            array[2] = getByItemId_PrevAndNext(session, shoppingItemField,
385                                            itemId, orderByComparator, false);
386    
387                            return array;
388                    }
389                    catch (Exception e) {
390                            throw processException(e);
391                    }
392                    finally {
393                            closeSession(session);
394                    }
395            }
396    
397            protected ShoppingItemField getByItemId_PrevAndNext(Session session,
398                    ShoppingItemField shoppingItemField, long itemId,
399                    OrderByComparator<ShoppingItemField> orderByComparator, boolean previous) {
400                    StringBundler query = null;
401    
402                    if (orderByComparator != null) {
403                            query = new StringBundler(6 +
404                                            (orderByComparator.getOrderByFields().length * 6));
405                    }
406                    else {
407                            query = new StringBundler(3);
408                    }
409    
410                    query.append(_SQL_SELECT_SHOPPINGITEMFIELD_WHERE);
411    
412                    query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
413    
414                    if (orderByComparator != null) {
415                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
416    
417                            if (orderByConditionFields.length > 0) {
418                                    query.append(WHERE_AND);
419                            }
420    
421                            for (int i = 0; i < orderByConditionFields.length; i++) {
422                                    query.append(_ORDER_BY_ENTITY_ALIAS);
423                                    query.append(orderByConditionFields[i]);
424    
425                                    if ((i + 1) < orderByConditionFields.length) {
426                                            if (orderByComparator.isAscending() ^ previous) {
427                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
428                                            }
429                                            else {
430                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
431                                            }
432                                    }
433                                    else {
434                                            if (orderByComparator.isAscending() ^ previous) {
435                                                    query.append(WHERE_GREATER_THAN);
436                                            }
437                                            else {
438                                                    query.append(WHERE_LESSER_THAN);
439                                            }
440                                    }
441                            }
442    
443                            query.append(ORDER_BY_CLAUSE);
444    
445                            String[] orderByFields = orderByComparator.getOrderByFields();
446    
447                            for (int i = 0; i < orderByFields.length; i++) {
448                                    query.append(_ORDER_BY_ENTITY_ALIAS);
449                                    query.append(orderByFields[i]);
450    
451                                    if ((i + 1) < orderByFields.length) {
452                                            if (orderByComparator.isAscending() ^ previous) {
453                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
454                                            }
455                                            else {
456                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
457                                            }
458                                    }
459                                    else {
460                                            if (orderByComparator.isAscending() ^ previous) {
461                                                    query.append(ORDER_BY_ASC);
462                                            }
463                                            else {
464                                                    query.append(ORDER_BY_DESC);
465                                            }
466                                    }
467                            }
468                    }
469                    else {
470                            query.append(ShoppingItemFieldModelImpl.ORDER_BY_JPQL);
471                    }
472    
473                    String sql = query.toString();
474    
475                    Query q = session.createQuery(sql);
476    
477                    q.setFirstResult(0);
478                    q.setMaxResults(2);
479    
480                    QueryPos qPos = QueryPos.getInstance(q);
481    
482                    qPos.add(itemId);
483    
484                    if (orderByComparator != null) {
485                            Object[] values = orderByComparator.getOrderByConditionValues(shoppingItemField);
486    
487                            for (Object value : values) {
488                                    qPos.add(value);
489                            }
490                    }
491    
492                    List<ShoppingItemField> list = q.list();
493    
494                    if (list.size() == 2) {
495                            return list.get(1);
496                    }
497                    else {
498                            return null;
499                    }
500            }
501    
502            /**
503             * Removes all the shopping item fields where itemId = &#63; from the database.
504             *
505             * @param itemId the item ID
506             */
507            @Override
508            public void removeByItemId(long itemId) {
509                    for (ShoppingItemField shoppingItemField : findByItemId(itemId,
510                                    QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
511                            remove(shoppingItemField);
512                    }
513            }
514    
515            /**
516             * Returns the number of shopping item fields where itemId = &#63;.
517             *
518             * @param itemId the item ID
519             * @return the number of matching shopping item fields
520             */
521            @Override
522            public int countByItemId(long itemId) {
523                    FinderPath finderPath = FINDER_PATH_COUNT_BY_ITEMID;
524    
525                    Object[] finderArgs = new Object[] { itemId };
526    
527                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
528                                    this);
529    
530                    if (count == null) {
531                            StringBundler query = new StringBundler(2);
532    
533                            query.append(_SQL_COUNT_SHOPPINGITEMFIELD_WHERE);
534    
535                            query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
536    
537                            String sql = query.toString();
538    
539                            Session session = null;
540    
541                            try {
542                                    session = openSession();
543    
544                                    Query q = session.createQuery(sql);
545    
546                                    QueryPos qPos = QueryPos.getInstance(q);
547    
548                                    qPos.add(itemId);
549    
550                                    count = (Long)q.uniqueResult();
551    
552                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
553                            }
554                            catch (Exception e) {
555                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
556    
557                                    throw processException(e);
558                            }
559                            finally {
560                                    closeSession(session);
561                            }
562                    }
563    
564                    return count.intValue();
565            }
566    
567            private static final String _FINDER_COLUMN_ITEMID_ITEMID_2 = "shoppingItemField.itemId = ?";
568    
569            public ShoppingItemFieldPersistenceImpl() {
570                    setModelClass(ShoppingItemField.class);
571            }
572    
573            /**
574             * Caches the shopping item field in the entity cache if it is enabled.
575             *
576             * @param shoppingItemField the shopping item field
577             */
578            @Override
579            public void cacheResult(ShoppingItemField shoppingItemField) {
580                    EntityCacheUtil.putResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
581                            ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey(),
582                            shoppingItemField);
583    
584                    shoppingItemField.resetOriginalValues();
585            }
586    
587            /**
588             * Caches the shopping item fields in the entity cache if it is enabled.
589             *
590             * @param shoppingItemFields the shopping item fields
591             */
592            @Override
593            public void cacheResult(List<ShoppingItemField> shoppingItemFields) {
594                    for (ShoppingItemField shoppingItemField : shoppingItemFields) {
595                            if (EntityCacheUtil.getResult(
596                                                    ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
597                                                    ShoppingItemFieldImpl.class,
598                                                    shoppingItemField.getPrimaryKey()) == null) {
599                                    cacheResult(shoppingItemField);
600                            }
601                            else {
602                                    shoppingItemField.resetOriginalValues();
603                            }
604                    }
605            }
606    
607            /**
608             * Clears the cache for all shopping item fields.
609             *
610             * <p>
611             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
612             * </p>
613             */
614            @Override
615            public void clearCache() {
616                    EntityCacheUtil.clearCache(ShoppingItemFieldImpl.class);
617    
618                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
619                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
620                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
621            }
622    
623            /**
624             * Clears the cache for the shopping item field.
625             *
626             * <p>
627             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
628             * </p>
629             */
630            @Override
631            public void clearCache(ShoppingItemField shoppingItemField) {
632                    EntityCacheUtil.removeResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
633                            ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey());
634    
635                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
636                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
637            }
638    
639            @Override
640            public void clearCache(List<ShoppingItemField> shoppingItemFields) {
641                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
642                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
643    
644                    for (ShoppingItemField shoppingItemField : shoppingItemFields) {
645                            EntityCacheUtil.removeResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
646                                    ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey());
647                    }
648            }
649    
650            /**
651             * Creates a new shopping item field with the primary key. Does not add the shopping item field to the database.
652             *
653             * @param itemFieldId the primary key for the new shopping item field
654             * @return the new shopping item field
655             */
656            @Override
657            public ShoppingItemField create(long itemFieldId) {
658                    ShoppingItemField shoppingItemField = new ShoppingItemFieldImpl();
659    
660                    shoppingItemField.setNew(true);
661                    shoppingItemField.setPrimaryKey(itemFieldId);
662    
663                    return shoppingItemField;
664            }
665    
666            /**
667             * Removes the shopping item field with the primary key from the database. Also notifies the appropriate model listeners.
668             *
669             * @param itemFieldId the primary key of the shopping item field
670             * @return the shopping item field that was removed
671             * @throws NoSuchItemFieldException if a shopping item field with the primary key could not be found
672             */
673            @Override
674            public ShoppingItemField remove(long itemFieldId)
675                    throws NoSuchItemFieldException {
676                    return remove((Serializable)itemFieldId);
677            }
678    
679            /**
680             * Removes the shopping item field with the primary key from the database. Also notifies the appropriate model listeners.
681             *
682             * @param primaryKey the primary key of the shopping item field
683             * @return the shopping item field that was removed
684             * @throws NoSuchItemFieldException if a shopping item field with the primary key could not be found
685             */
686            @Override
687            public ShoppingItemField remove(Serializable primaryKey)
688                    throws NoSuchItemFieldException {
689                    Session session = null;
690    
691                    try {
692                            session = openSession();
693    
694                            ShoppingItemField shoppingItemField = (ShoppingItemField)session.get(ShoppingItemFieldImpl.class,
695                                            primaryKey);
696    
697                            if (shoppingItemField == null) {
698                                    if (_log.isWarnEnabled()) {
699                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
700                                    }
701    
702                                    throw new NoSuchItemFieldException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
703                                            primaryKey);
704                            }
705    
706                            return remove(shoppingItemField);
707                    }
708                    catch (NoSuchItemFieldException nsee) {
709                            throw nsee;
710                    }
711                    catch (Exception e) {
712                            throw processException(e);
713                    }
714                    finally {
715                            closeSession(session);
716                    }
717            }
718    
719            @Override
720            protected ShoppingItemField removeImpl(ShoppingItemField shoppingItemField) {
721                    shoppingItemField = toUnwrappedModel(shoppingItemField);
722    
723                    Session session = null;
724    
725                    try {
726                            session = openSession();
727    
728                            if (!session.contains(shoppingItemField)) {
729                                    shoppingItemField = (ShoppingItemField)session.get(ShoppingItemFieldImpl.class,
730                                                    shoppingItemField.getPrimaryKeyObj());
731                            }
732    
733                            if (shoppingItemField != null) {
734                                    session.delete(shoppingItemField);
735                            }
736                    }
737                    catch (Exception e) {
738                            throw processException(e);
739                    }
740                    finally {
741                            closeSession(session);
742                    }
743    
744                    if (shoppingItemField != null) {
745                            clearCache(shoppingItemField);
746                    }
747    
748                    return shoppingItemField;
749            }
750    
751            @Override
752            public ShoppingItemField updateImpl(ShoppingItemField shoppingItemField) {
753                    shoppingItemField = toUnwrappedModel(shoppingItemField);
754    
755                    boolean isNew = shoppingItemField.isNew();
756    
757                    ShoppingItemFieldModelImpl shoppingItemFieldModelImpl = (ShoppingItemFieldModelImpl)shoppingItemField;
758    
759                    Session session = null;
760    
761                    try {
762                            session = openSession();
763    
764                            if (shoppingItemField.isNew()) {
765                                    session.save(shoppingItemField);
766    
767                                    shoppingItemField.setNew(false);
768                            }
769                            else {
770                                    session.merge(shoppingItemField);
771                            }
772                    }
773                    catch (Exception e) {
774                            throw processException(e);
775                    }
776                    finally {
777                            closeSession(session);
778                    }
779    
780                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
781    
782                    if (isNew || !ShoppingItemFieldModelImpl.COLUMN_BITMASK_ENABLED) {
783                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
784                    }
785    
786                    else {
787                            if ((shoppingItemFieldModelImpl.getColumnBitmask() &
788                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID.getColumnBitmask()) != 0) {
789                                    Object[] args = new Object[] {
790                                                    shoppingItemFieldModelImpl.getOriginalItemId()
791                                            };
792    
793                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ITEMID, args);
794                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID,
795                                            args);
796    
797                                    args = new Object[] { shoppingItemFieldModelImpl.getItemId() };
798    
799                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ITEMID, args);
800                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID,
801                                            args);
802                            }
803                    }
804    
805                    EntityCacheUtil.putResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
806                            ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey(),
807                            shoppingItemField, false);
808    
809                    shoppingItemField.resetOriginalValues();
810    
811                    return shoppingItemField;
812            }
813    
814            protected ShoppingItemField toUnwrappedModel(
815                    ShoppingItemField shoppingItemField) {
816                    if (shoppingItemField instanceof ShoppingItemFieldImpl) {
817                            return shoppingItemField;
818                    }
819    
820                    ShoppingItemFieldImpl shoppingItemFieldImpl = new ShoppingItemFieldImpl();
821    
822                    shoppingItemFieldImpl.setNew(shoppingItemField.isNew());
823                    shoppingItemFieldImpl.setPrimaryKey(shoppingItemField.getPrimaryKey());
824    
825                    shoppingItemFieldImpl.setItemFieldId(shoppingItemField.getItemFieldId());
826                    shoppingItemFieldImpl.setItemId(shoppingItemField.getItemId());
827                    shoppingItemFieldImpl.setName(shoppingItemField.getName());
828                    shoppingItemFieldImpl.setValues(shoppingItemField.getValues());
829                    shoppingItemFieldImpl.setDescription(shoppingItemField.getDescription());
830    
831                    return shoppingItemFieldImpl;
832            }
833    
834            /**
835             * Returns the shopping item field with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
836             *
837             * @param primaryKey the primary key of the shopping item field
838             * @return the shopping item field
839             * @throws NoSuchItemFieldException if a shopping item field with the primary key could not be found
840             */
841            @Override
842            public ShoppingItemField findByPrimaryKey(Serializable primaryKey)
843                    throws NoSuchItemFieldException {
844                    ShoppingItemField shoppingItemField = fetchByPrimaryKey(primaryKey);
845    
846                    if (shoppingItemField == null) {
847                            if (_log.isWarnEnabled()) {
848                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
849                            }
850    
851                            throw new NoSuchItemFieldException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
852                                    primaryKey);
853                    }
854    
855                    return shoppingItemField;
856            }
857    
858            /**
859             * Returns the shopping item field with the primary key or throws a {@link NoSuchItemFieldException} if it could not be found.
860             *
861             * @param itemFieldId the primary key of the shopping item field
862             * @return the shopping item field
863             * @throws NoSuchItemFieldException if a shopping item field with the primary key could not be found
864             */
865            @Override
866            public ShoppingItemField findByPrimaryKey(long itemFieldId)
867                    throws NoSuchItemFieldException {
868                    return findByPrimaryKey((Serializable)itemFieldId);
869            }
870    
871            /**
872             * Returns the shopping item field with the primary key or returns <code>null</code> if it could not be found.
873             *
874             * @param primaryKey the primary key of the shopping item field
875             * @return the shopping item field, or <code>null</code> if a shopping item field with the primary key could not be found
876             */
877            @Override
878            public ShoppingItemField fetchByPrimaryKey(Serializable primaryKey) {
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             */
924            @Override
925            public ShoppingItemField fetchByPrimaryKey(long itemFieldId) {
926                    return fetchByPrimaryKey((Serializable)itemFieldId);
927            }
928    
929            @Override
930            public Map<Serializable, ShoppingItemField> fetchByPrimaryKeys(
931                    Set<Serializable> primaryKeys) {
932                    if (primaryKeys.isEmpty()) {
933                            return Collections.emptyMap();
934                    }
935    
936                    Map<Serializable, ShoppingItemField> map = new HashMap<Serializable, ShoppingItemField>();
937    
938                    if (primaryKeys.size() == 1) {
939                            Iterator<Serializable> iterator = primaryKeys.iterator();
940    
941                            Serializable primaryKey = iterator.next();
942    
943                            ShoppingItemField shoppingItemField = fetchByPrimaryKey(primaryKey);
944    
945                            if (shoppingItemField != null) {
946                                    map.put(primaryKey, shoppingItemField);
947                            }
948    
949                            return map;
950                    }
951    
952                    Set<Serializable> uncachedPrimaryKeys = null;
953    
954                    for (Serializable primaryKey : primaryKeys) {
955                            ShoppingItemField shoppingItemField = (ShoppingItemField)EntityCacheUtil.getResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
956                                            ShoppingItemFieldImpl.class, primaryKey);
957    
958                            if (shoppingItemField == null) {
959                                    if (uncachedPrimaryKeys == null) {
960                                            uncachedPrimaryKeys = new HashSet<Serializable>();
961                                    }
962    
963                                    uncachedPrimaryKeys.add(primaryKey);
964                            }
965                            else {
966                                    map.put(primaryKey, shoppingItemField);
967                            }
968                    }
969    
970                    if (uncachedPrimaryKeys == null) {
971                            return map;
972                    }
973    
974                    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
975                                    1);
976    
977                    query.append(_SQL_SELECT_SHOPPINGITEMFIELD_WHERE_PKS_IN);
978    
979                    for (Serializable primaryKey : uncachedPrimaryKeys) {
980                            query.append(String.valueOf(primaryKey));
981    
982                            query.append(StringPool.COMMA);
983                    }
984    
985                    query.setIndex(query.index() - 1);
986    
987                    query.append(StringPool.CLOSE_PARENTHESIS);
988    
989                    String sql = query.toString();
990    
991                    Session session = null;
992    
993                    try {
994                            session = openSession();
995    
996                            Query q = session.createQuery(sql);
997    
998                            for (ShoppingItemField shoppingItemField : (List<ShoppingItemField>)q.list()) {
999                                    map.put(shoppingItemField.getPrimaryKeyObj(), shoppingItemField);
1000    
1001                                    cacheResult(shoppingItemField);
1002    
1003                                    uncachedPrimaryKeys.remove(shoppingItemField.getPrimaryKeyObj());
1004                            }
1005    
1006                            for (Serializable primaryKey : uncachedPrimaryKeys) {
1007                                    EntityCacheUtil.putResult(ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
1008                                            ShoppingItemFieldImpl.class, primaryKey,
1009                                            _nullShoppingItemField);
1010                            }
1011                    }
1012                    catch (Exception e) {
1013                            throw processException(e);
1014                    }
1015                    finally {
1016                            closeSession(session);
1017                    }
1018    
1019                    return map;
1020            }
1021    
1022            /**
1023             * Returns all the shopping item fields.
1024             *
1025             * @return the shopping item fields
1026             */
1027            @Override
1028            public List<ShoppingItemField> findAll() {
1029                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1030            }
1031    
1032            /**
1033             * Returns a range of all the shopping item fields.
1034             *
1035             * <p>
1036             * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link 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.
1037             * </p>
1038             *
1039             * @param start the lower bound of the range of shopping item fields
1040             * @param end the upper bound of the range of shopping item fields (not inclusive)
1041             * @return the range of shopping item fields
1042             */
1043            @Override
1044            public List<ShoppingItemField> findAll(int start, int end) {
1045                    return findAll(start, end, null);
1046            }
1047    
1048            /**
1049             * Returns an ordered range of all the shopping item fields.
1050             *
1051             * <p>
1052             * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link 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.
1053             * </p>
1054             *
1055             * @param start the lower bound of the range of shopping item fields
1056             * @param end the upper bound of the range of shopping item fields (not inclusive)
1057             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1058             * @return the ordered range of shopping item fields
1059             */
1060            @Override
1061            public List<ShoppingItemField> findAll(int start, int end,
1062                    OrderByComparator<ShoppingItemField> orderByComparator) {
1063                    boolean pagination = true;
1064                    FinderPath finderPath = null;
1065                    Object[] finderArgs = null;
1066    
1067                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1068                                    (orderByComparator == null)) {
1069                            pagination = false;
1070                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1071                            finderArgs = FINDER_ARGS_EMPTY;
1072                    }
1073                    else {
1074                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1075                            finderArgs = new Object[] { start, end, orderByComparator };
1076                    }
1077    
1078                    List<ShoppingItemField> list = (List<ShoppingItemField>)FinderCacheUtil.getResult(finderPath,
1079                                    finderArgs, this);
1080    
1081                    if (list == null) {
1082                            StringBundler query = null;
1083                            String sql = null;
1084    
1085                            if (orderByComparator != null) {
1086                                    query = new StringBundler(2 +
1087                                                    (orderByComparator.getOrderByFields().length * 3));
1088    
1089                                    query.append(_SQL_SELECT_SHOPPINGITEMFIELD);
1090    
1091                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1092                                            orderByComparator);
1093    
1094                                    sql = query.toString();
1095                            }
1096                            else {
1097                                    sql = _SQL_SELECT_SHOPPINGITEMFIELD;
1098    
1099                                    if (pagination) {
1100                                            sql = sql.concat(ShoppingItemFieldModelImpl.ORDER_BY_JPQL);
1101                                    }
1102                            }
1103    
1104                            Session session = null;
1105    
1106                            try {
1107                                    session = openSession();
1108    
1109                                    Query q = session.createQuery(sql);
1110    
1111                                    if (!pagination) {
1112                                            list = (List<ShoppingItemField>)QueryUtil.list(q,
1113                                                            getDialect(), start, end, false);
1114    
1115                                            Collections.sort(list);
1116    
1117                                            list = Collections.unmodifiableList(list);
1118                                    }
1119                                    else {
1120                                            list = (List<ShoppingItemField>)QueryUtil.list(q,
1121                                                            getDialect(), start, end);
1122                                    }
1123    
1124                                    cacheResult(list);
1125    
1126                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
1127                            }
1128                            catch (Exception e) {
1129                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1130    
1131                                    throw processException(e);
1132                            }
1133                            finally {
1134                                    closeSession(session);
1135                            }
1136                    }
1137    
1138                    return list;
1139            }
1140    
1141            /**
1142             * Removes all the shopping item fields from the database.
1143             *
1144             */
1145            @Override
1146            public void removeAll() {
1147                    for (ShoppingItemField shoppingItemField : findAll()) {
1148                            remove(shoppingItemField);
1149                    }
1150            }
1151    
1152            /**
1153             * Returns the number of shopping item fields.
1154             *
1155             * @return the number of shopping item fields
1156             */
1157            @Override
1158            public int countAll() {
1159                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1160                                    FINDER_ARGS_EMPTY, this);
1161    
1162                    if (count == null) {
1163                            Session session = null;
1164    
1165                            try {
1166                                    session = openSession();
1167    
1168                                    Query q = session.createQuery(_SQL_COUNT_SHOPPINGITEMFIELD);
1169    
1170                                    count = (Long)q.uniqueResult();
1171    
1172                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1173                                            FINDER_ARGS_EMPTY, count);
1174                            }
1175                            catch (Exception e) {
1176                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
1177                                            FINDER_ARGS_EMPTY);
1178    
1179                                    throw processException(e);
1180                            }
1181                            finally {
1182                                    closeSession(session);
1183                            }
1184                    }
1185    
1186                    return count.intValue();
1187            }
1188    
1189            @Override
1190            protected Set<String> getBadColumnNames() {
1191                    return _badColumnNames;
1192            }
1193    
1194            /**
1195             * Initializes the shopping item field persistence.
1196             */
1197            public void afterPropertiesSet() {
1198            }
1199    
1200            public void destroy() {
1201                    EntityCacheUtil.removeCache(ShoppingItemFieldImpl.class.getName());
1202                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1203                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1204                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1205            }
1206    
1207            private static final String _SQL_SELECT_SHOPPINGITEMFIELD = "SELECT shoppingItemField FROM ShoppingItemField shoppingItemField";
1208            private static final String _SQL_SELECT_SHOPPINGITEMFIELD_WHERE_PKS_IN = "SELECT shoppingItemField FROM ShoppingItemField shoppingItemField WHERE itemFieldId IN (";
1209            private static final String _SQL_SELECT_SHOPPINGITEMFIELD_WHERE = "SELECT shoppingItemField FROM ShoppingItemField shoppingItemField WHERE ";
1210            private static final String _SQL_COUNT_SHOPPINGITEMFIELD = "SELECT COUNT(shoppingItemField) FROM ShoppingItemField shoppingItemField";
1211            private static final String _SQL_COUNT_SHOPPINGITEMFIELD_WHERE = "SELECT COUNT(shoppingItemField) FROM ShoppingItemField shoppingItemField WHERE ";
1212            private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingItemField.";
1213            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingItemField exists with the primary key ";
1214            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingItemField exists with the key {";
1215            private static final Log _log = LogFactoryUtil.getLog(ShoppingItemFieldPersistenceImpl.class);
1216            private static final Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
1217                                    "values"
1218                            });
1219            private static final ShoppingItemField _nullShoppingItemField = new ShoppingItemFieldImpl() {
1220                            @Override
1221                            public Object clone() {
1222                                    return this;
1223                            }
1224    
1225                            @Override
1226                            public CacheModel<ShoppingItemField> toCacheModel() {
1227                                    return _nullShoppingItemFieldCacheModel;
1228                            }
1229                    };
1230    
1231            private static final CacheModel<ShoppingItemField> _nullShoppingItemFieldCacheModel =
1232                    new CacheModel<ShoppingItemField>() {
1233                            @Override
1234                            public ShoppingItemField toEntityModel() {
1235                                    return _nullShoppingItemField;
1236                            }
1237                    };
1238    }