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