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.StringBundler;
030    import com.liferay.portal.kernel.util.StringPool;
031    import com.liferay.portal.model.CacheModel;
032    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
033    
034    import com.liferay.portlet.shopping.NoSuchOrderItemException;
035    import com.liferay.portlet.shopping.model.ShoppingOrderItem;
036    import com.liferay.portlet.shopping.model.impl.ShoppingOrderItemImpl;
037    import com.liferay.portlet.shopping.model.impl.ShoppingOrderItemModelImpl;
038    import com.liferay.portlet.shopping.service.persistence.ShoppingOrderItemPersistence;
039    
040    import java.io.Serializable;
041    
042    import java.util.Collections;
043    import java.util.HashMap;
044    import java.util.HashSet;
045    import java.util.Iterator;
046    import java.util.List;
047    import java.util.Map;
048    import java.util.Set;
049    
050    /**
051     * The persistence implementation for the shopping order item service.
052     *
053     * <p>
054     * Caching information and settings can be found in <code>portal.properties</code>
055     * </p>
056     *
057     * @author Brian Wing Shun Chan
058     * @see ShoppingOrderItemPersistence
059     * @see com.liferay.portlet.shopping.service.persistence.ShoppingOrderItemUtil
060     * @generated
061     */
062    @ProviderType
063    public class ShoppingOrderItemPersistenceImpl extends BasePersistenceImpl<ShoppingOrderItem>
064            implements ShoppingOrderItemPersistence {
065            /*
066             * NOTE FOR DEVELOPERS:
067             *
068             * Never modify or reference this class directly. Always use {@link ShoppingOrderItemUtil} to access the shopping order item persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
069             */
070            public static final String FINDER_CLASS_NAME_ENTITY = ShoppingOrderItemImpl.class.getName();
071            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072                    ".List1";
073            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074                    ".List2";
075            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
076                            ShoppingOrderItemModelImpl.FINDER_CACHE_ENABLED,
077                            ShoppingOrderItemImpl.class,
078                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
079            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
080                            ShoppingOrderItemModelImpl.FINDER_CACHE_ENABLED,
081                            ShoppingOrderItemImpl.class,
082                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
083            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
084                            ShoppingOrderItemModelImpl.FINDER_CACHE_ENABLED, Long.class,
085                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
086            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ORDERID = new FinderPath(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
087                            ShoppingOrderItemModelImpl.FINDER_CACHE_ENABLED,
088                            ShoppingOrderItemImpl.class,
089                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByOrderId",
090                            new String[] {
091                                    Long.class.getName(),
092                                    
093                            Integer.class.getName(), Integer.class.getName(),
094                                    OrderByComparator.class.getName()
095                            });
096            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ORDERID =
097                    new FinderPath(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
098                            ShoppingOrderItemModelImpl.FINDER_CACHE_ENABLED,
099                            ShoppingOrderItemImpl.class,
100                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByOrderId",
101                            new String[] { Long.class.getName() },
102                            ShoppingOrderItemModelImpl.ORDERID_COLUMN_BITMASK |
103                            ShoppingOrderItemModelImpl.NAME_COLUMN_BITMASK |
104                            ShoppingOrderItemModelImpl.DESCRIPTION_COLUMN_BITMASK);
105            public static final FinderPath FINDER_PATH_COUNT_BY_ORDERID = new FinderPath(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
106                            ShoppingOrderItemModelImpl.FINDER_CACHE_ENABLED, Long.class,
107                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByOrderId",
108                            new String[] { Long.class.getName() });
109    
110            /**
111             * Returns all the shopping order items where orderId = &#63;.
112             *
113             * @param orderId the order ID
114             * @return the matching shopping order items
115             */
116            @Override
117            public List<ShoppingOrderItem> findByOrderId(long orderId) {
118                    return findByOrderId(orderId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
119            }
120    
121            /**
122             * Returns a range of all the shopping order items where orderId = &#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 ShoppingOrderItemModelImpl}. 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 orderId the order ID
129             * @param start the lower bound of the range of shopping order items
130             * @param end the upper bound of the range of shopping order items (not inclusive)
131             * @return the range of matching shopping order items
132             */
133            @Override
134            public List<ShoppingOrderItem> findByOrderId(long orderId, int start,
135                    int end) {
136                    return findByOrderId(orderId, start, end, null);
137            }
138    
139            /**
140             * Returns an ordered range of all the shopping order items where orderId = &#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 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 ShoppingOrderItemModelImpl}. 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 orderId the order ID
147             * @param start the lower bound of the range of shopping order items
148             * @param end the upper bound of the range of shopping order items (not inclusive)
149             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
150             * @return the ordered range of matching shopping order items
151             */
152            @Override
153            public List<ShoppingOrderItem> findByOrderId(long orderId, int start,
154                    int end, OrderByComparator<ShoppingOrderItem> 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_ORDERID;
163                            finderArgs = new Object[] { orderId };
164                    }
165                    else {
166                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ORDERID;
167                            finderArgs = new Object[] { orderId, start, end, orderByComparator };
168                    }
169    
170                    List<ShoppingOrderItem> list = (List<ShoppingOrderItem>)FinderCacheUtil.getResult(finderPath,
171                                    finderArgs, this);
172    
173                    if ((list != null) && !list.isEmpty()) {
174                            for (ShoppingOrderItem shoppingOrderItem : list) {
175                                    if ((orderId != shoppingOrderItem.getOrderId())) {
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_SHOPPINGORDERITEM_WHERE);
195    
196                            query.append(_FINDER_COLUMN_ORDERID_ORDERID_2);
197    
198                            if (orderByComparator != null) {
199                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
200                                            orderByComparator);
201                            }
202                            else
203                             if (pagination) {
204                                    query.append(ShoppingOrderItemModelImpl.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(orderId);
219    
220                                    if (!pagination) {
221                                            list = (List<ShoppingOrderItem>)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<ShoppingOrderItem>)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 order item in the ordered set where orderId = &#63;.
252             *
253             * @param orderId the order ID
254             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
255             * @return the first matching shopping order item
256             * @throws NoSuchOrderItemException if a matching shopping order item could not be found
257             */
258            @Override
259            public ShoppingOrderItem findByOrderId_First(long orderId,
260                    OrderByComparator<ShoppingOrderItem> orderByComparator)
261                    throws NoSuchOrderItemException {
262                    ShoppingOrderItem shoppingOrderItem = fetchByOrderId_First(orderId,
263                                    orderByComparator);
264    
265                    if (shoppingOrderItem != null) {
266                            return shoppingOrderItem;
267                    }
268    
269                    StringBundler msg = new StringBundler(4);
270    
271                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
272    
273                    msg.append("orderId=");
274                    msg.append(orderId);
275    
276                    msg.append(StringPool.CLOSE_CURLY_BRACE);
277    
278                    throw new NoSuchOrderItemException(msg.toString());
279            }
280    
281            /**
282             * Returns the first shopping order item in the ordered set where orderId = &#63;.
283             *
284             * @param orderId the order ID
285             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
286             * @return the first matching shopping order item, or <code>null</code> if a matching shopping order item could not be found
287             */
288            @Override
289            public ShoppingOrderItem fetchByOrderId_First(long orderId,
290                    OrderByComparator<ShoppingOrderItem> orderByComparator) {
291                    List<ShoppingOrderItem> list = findByOrderId(orderId, 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 order item in the ordered set where orderId = &#63;.
303             *
304             * @param orderId the order ID
305             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
306             * @return the last matching shopping order item
307             * @throws NoSuchOrderItemException if a matching shopping order item could not be found
308             */
309            @Override
310            public ShoppingOrderItem findByOrderId_Last(long orderId,
311                    OrderByComparator<ShoppingOrderItem> orderByComparator)
312                    throws NoSuchOrderItemException {
313                    ShoppingOrderItem shoppingOrderItem = fetchByOrderId_Last(orderId,
314                                    orderByComparator);
315    
316                    if (shoppingOrderItem != null) {
317                            return shoppingOrderItem;
318                    }
319    
320                    StringBundler msg = new StringBundler(4);
321    
322                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
323    
324                    msg.append("orderId=");
325                    msg.append(orderId);
326    
327                    msg.append(StringPool.CLOSE_CURLY_BRACE);
328    
329                    throw new NoSuchOrderItemException(msg.toString());
330            }
331    
332            /**
333             * Returns the last shopping order item in the ordered set where orderId = &#63;.
334             *
335             * @param orderId the order ID
336             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
337             * @return the last matching shopping order item, or <code>null</code> if a matching shopping order item could not be found
338             */
339            @Override
340            public ShoppingOrderItem fetchByOrderId_Last(long orderId,
341                    OrderByComparator<ShoppingOrderItem> orderByComparator) {
342                    int count = countByOrderId(orderId);
343    
344                    if (count == 0) {
345                            return null;
346                    }
347    
348                    List<ShoppingOrderItem> list = findByOrderId(orderId, 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 order items before and after the current shopping order item in the ordered set where orderId = &#63;.
360             *
361             * @param orderItemId the primary key of the current shopping order item
362             * @param orderId the order ID
363             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
364             * @return the previous, current, and next shopping order item
365             * @throws NoSuchOrderItemException if a shopping order item with the primary key could not be found
366             */
367            @Override
368            public ShoppingOrderItem[] findByOrderId_PrevAndNext(long orderItemId,
369                    long orderId, OrderByComparator<ShoppingOrderItem> orderByComparator)
370                    throws NoSuchOrderItemException {
371                    ShoppingOrderItem shoppingOrderItem = findByPrimaryKey(orderItemId);
372    
373                    Session session = null;
374    
375                    try {
376                            session = openSession();
377    
378                            ShoppingOrderItem[] array = new ShoppingOrderItemImpl[3];
379    
380                            array[0] = getByOrderId_PrevAndNext(session, shoppingOrderItem,
381                                            orderId, orderByComparator, true);
382    
383                            array[1] = shoppingOrderItem;
384    
385                            array[2] = getByOrderId_PrevAndNext(session, shoppingOrderItem,
386                                            orderId, 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 ShoppingOrderItem getByOrderId_PrevAndNext(Session session,
399                    ShoppingOrderItem shoppingOrderItem, long orderId,
400                    OrderByComparator<ShoppingOrderItem> 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_SHOPPINGORDERITEM_WHERE);
412    
413                    query.append(_FINDER_COLUMN_ORDERID_ORDERID_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(ShoppingOrderItemModelImpl.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(orderId);
484    
485                    if (orderByComparator != null) {
486                            Object[] values = orderByComparator.getOrderByConditionValues(shoppingOrderItem);
487    
488                            for (Object value : values) {
489                                    qPos.add(value);
490                            }
491                    }
492    
493                    List<ShoppingOrderItem> 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 order items where orderId = &#63; from the database.
505             *
506             * @param orderId the order ID
507             */
508            @Override
509            public void removeByOrderId(long orderId) {
510                    for (ShoppingOrderItem shoppingOrderItem : findByOrderId(orderId,
511                                    QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
512                            remove(shoppingOrderItem);
513                    }
514            }
515    
516            /**
517             * Returns the number of shopping order items where orderId = &#63;.
518             *
519             * @param orderId the order ID
520             * @return the number of matching shopping order items
521             */
522            @Override
523            public int countByOrderId(long orderId) {
524                    FinderPath finderPath = FINDER_PATH_COUNT_BY_ORDERID;
525    
526                    Object[] finderArgs = new Object[] { orderId };
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_SHOPPINGORDERITEM_WHERE);
535    
536                            query.append(_FINDER_COLUMN_ORDERID_ORDERID_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(orderId);
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_ORDERID_ORDERID_2 = "shoppingOrderItem.orderId = ?";
569    
570            public ShoppingOrderItemPersistenceImpl() {
571                    setModelClass(ShoppingOrderItem.class);
572            }
573    
574            /**
575             * Caches the shopping order item in the entity cache if it is enabled.
576             *
577             * @param shoppingOrderItem the shopping order item
578             */
579            @Override
580            public void cacheResult(ShoppingOrderItem shoppingOrderItem) {
581                    EntityCacheUtil.putResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
582                            ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey(),
583                            shoppingOrderItem);
584    
585                    shoppingOrderItem.resetOriginalValues();
586            }
587    
588            /**
589             * Caches the shopping order items in the entity cache if it is enabled.
590             *
591             * @param shoppingOrderItems the shopping order items
592             */
593            @Override
594            public void cacheResult(List<ShoppingOrderItem> shoppingOrderItems) {
595                    for (ShoppingOrderItem shoppingOrderItem : shoppingOrderItems) {
596                            if (EntityCacheUtil.getResult(
597                                                    ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
598                                                    ShoppingOrderItemImpl.class,
599                                                    shoppingOrderItem.getPrimaryKey()) == null) {
600                                    cacheResult(shoppingOrderItem);
601                            }
602                            else {
603                                    shoppingOrderItem.resetOriginalValues();
604                            }
605                    }
606            }
607    
608            /**
609             * Clears the cache for all shopping order items.
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                    EntityCacheUtil.clearCache(ShoppingOrderItemImpl.class);
618    
619                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
620                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
621                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
622            }
623    
624            /**
625             * Clears the cache for the shopping order item.
626             *
627             * <p>
628             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
629             * </p>
630             */
631            @Override
632            public void clearCache(ShoppingOrderItem shoppingOrderItem) {
633                    EntityCacheUtil.removeResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
634                            ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey());
635    
636                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
637                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
638            }
639    
640            @Override
641            public void clearCache(List<ShoppingOrderItem> shoppingOrderItems) {
642                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
643                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
644    
645                    for (ShoppingOrderItem shoppingOrderItem : shoppingOrderItems) {
646                            EntityCacheUtil.removeResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
647                                    ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey());
648                    }
649            }
650    
651            /**
652             * Creates a new shopping order item with the primary key. Does not add the shopping order item to the database.
653             *
654             * @param orderItemId the primary key for the new shopping order item
655             * @return the new shopping order item
656             */
657            @Override
658            public ShoppingOrderItem create(long orderItemId) {
659                    ShoppingOrderItem shoppingOrderItem = new ShoppingOrderItemImpl();
660    
661                    shoppingOrderItem.setNew(true);
662                    shoppingOrderItem.setPrimaryKey(orderItemId);
663    
664                    return shoppingOrderItem;
665            }
666    
667            /**
668             * Removes the shopping order item with the primary key from the database. Also notifies the appropriate model listeners.
669             *
670             * @param orderItemId the primary key of the shopping order item
671             * @return the shopping order item that was removed
672             * @throws NoSuchOrderItemException if a shopping order item with the primary key could not be found
673             */
674            @Override
675            public ShoppingOrderItem remove(long orderItemId)
676                    throws NoSuchOrderItemException {
677                    return remove((Serializable)orderItemId);
678            }
679    
680            /**
681             * Removes the shopping order item with the primary key from the database. Also notifies the appropriate model listeners.
682             *
683             * @param primaryKey the primary key of the shopping order item
684             * @return the shopping order item that was removed
685             * @throws NoSuchOrderItemException if a shopping order item with the primary key could not be found
686             */
687            @Override
688            public ShoppingOrderItem remove(Serializable primaryKey)
689                    throws NoSuchOrderItemException {
690                    Session session = null;
691    
692                    try {
693                            session = openSession();
694    
695                            ShoppingOrderItem shoppingOrderItem = (ShoppingOrderItem)session.get(ShoppingOrderItemImpl.class,
696                                            primaryKey);
697    
698                            if (shoppingOrderItem == null) {
699                                    if (_log.isWarnEnabled()) {
700                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
701                                    }
702    
703                                    throw new NoSuchOrderItemException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
704                                            primaryKey);
705                            }
706    
707                            return remove(shoppingOrderItem);
708                    }
709                    catch (NoSuchOrderItemException nsee) {
710                            throw nsee;
711                    }
712                    catch (Exception e) {
713                            throw processException(e);
714                    }
715                    finally {
716                            closeSession(session);
717                    }
718            }
719    
720            @Override
721            protected ShoppingOrderItem removeImpl(ShoppingOrderItem shoppingOrderItem) {
722                    shoppingOrderItem = toUnwrappedModel(shoppingOrderItem);
723    
724                    Session session = null;
725    
726                    try {
727                            session = openSession();
728    
729                            if (!session.contains(shoppingOrderItem)) {
730                                    shoppingOrderItem = (ShoppingOrderItem)session.get(ShoppingOrderItemImpl.class,
731                                                    shoppingOrderItem.getPrimaryKeyObj());
732                            }
733    
734                            if (shoppingOrderItem != null) {
735                                    session.delete(shoppingOrderItem);
736                            }
737                    }
738                    catch (Exception e) {
739                            throw processException(e);
740                    }
741                    finally {
742                            closeSession(session);
743                    }
744    
745                    if (shoppingOrderItem != null) {
746                            clearCache(shoppingOrderItem);
747                    }
748    
749                    return shoppingOrderItem;
750            }
751    
752            @Override
753            public ShoppingOrderItem updateImpl(ShoppingOrderItem shoppingOrderItem) {
754                    shoppingOrderItem = toUnwrappedModel(shoppingOrderItem);
755    
756                    boolean isNew = shoppingOrderItem.isNew();
757    
758                    ShoppingOrderItemModelImpl shoppingOrderItemModelImpl = (ShoppingOrderItemModelImpl)shoppingOrderItem;
759    
760                    Session session = null;
761    
762                    try {
763                            session = openSession();
764    
765                            if (shoppingOrderItem.isNew()) {
766                                    session.save(shoppingOrderItem);
767    
768                                    shoppingOrderItem.setNew(false);
769                            }
770                            else {
771                                    session.merge(shoppingOrderItem);
772                            }
773                    }
774                    catch (Exception e) {
775                            throw processException(e);
776                    }
777                    finally {
778                            closeSession(session);
779                    }
780    
781                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
782    
783                    if (isNew || !ShoppingOrderItemModelImpl.COLUMN_BITMASK_ENABLED) {
784                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
785                    }
786    
787                    else {
788                            if ((shoppingOrderItemModelImpl.getColumnBitmask() &
789                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ORDERID.getColumnBitmask()) != 0) {
790                                    Object[] args = new Object[] {
791                                                    shoppingOrderItemModelImpl.getOriginalOrderId()
792                                            };
793    
794                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ORDERID, args);
795                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ORDERID,
796                                            args);
797    
798                                    args = new Object[] { shoppingOrderItemModelImpl.getOrderId() };
799    
800                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ORDERID, args);
801                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ORDERID,
802                                            args);
803                            }
804                    }
805    
806                    EntityCacheUtil.putResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
807                            ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey(),
808                            shoppingOrderItem, false);
809    
810                    shoppingOrderItem.resetOriginalValues();
811    
812                    return shoppingOrderItem;
813            }
814    
815            protected ShoppingOrderItem toUnwrappedModel(
816                    ShoppingOrderItem shoppingOrderItem) {
817                    if (shoppingOrderItem instanceof ShoppingOrderItemImpl) {
818                            return shoppingOrderItem;
819                    }
820    
821                    ShoppingOrderItemImpl shoppingOrderItemImpl = new ShoppingOrderItemImpl();
822    
823                    shoppingOrderItemImpl.setNew(shoppingOrderItem.isNew());
824                    shoppingOrderItemImpl.setPrimaryKey(shoppingOrderItem.getPrimaryKey());
825    
826                    shoppingOrderItemImpl.setOrderItemId(shoppingOrderItem.getOrderItemId());
827                    shoppingOrderItemImpl.setOrderId(shoppingOrderItem.getOrderId());
828                    shoppingOrderItemImpl.setItemId(shoppingOrderItem.getItemId());
829                    shoppingOrderItemImpl.setSku(shoppingOrderItem.getSku());
830                    shoppingOrderItemImpl.setName(shoppingOrderItem.getName());
831                    shoppingOrderItemImpl.setDescription(shoppingOrderItem.getDescription());
832                    shoppingOrderItemImpl.setProperties(shoppingOrderItem.getProperties());
833                    shoppingOrderItemImpl.setPrice(shoppingOrderItem.getPrice());
834                    shoppingOrderItemImpl.setQuantity(shoppingOrderItem.getQuantity());
835                    shoppingOrderItemImpl.setShippedDate(shoppingOrderItem.getShippedDate());
836    
837                    return shoppingOrderItemImpl;
838            }
839    
840            /**
841             * Returns the shopping order item 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 order item
844             * @return the shopping order item
845             * @throws NoSuchOrderItemException if a shopping order item with the primary key could not be found
846             */
847            @Override
848            public ShoppingOrderItem findByPrimaryKey(Serializable primaryKey)
849                    throws NoSuchOrderItemException {
850                    ShoppingOrderItem shoppingOrderItem = fetchByPrimaryKey(primaryKey);
851    
852                    if (shoppingOrderItem == null) {
853                            if (_log.isWarnEnabled()) {
854                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
855                            }
856    
857                            throw new NoSuchOrderItemException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
858                                    primaryKey);
859                    }
860    
861                    return shoppingOrderItem;
862            }
863    
864            /**
865             * Returns the shopping order item with the primary key or throws a {@link NoSuchOrderItemException} if it could not be found.
866             *
867             * @param orderItemId the primary key of the shopping order item
868             * @return the shopping order item
869             * @throws NoSuchOrderItemException if a shopping order item with the primary key could not be found
870             */
871            @Override
872            public ShoppingOrderItem findByPrimaryKey(long orderItemId)
873                    throws NoSuchOrderItemException {
874                    return findByPrimaryKey((Serializable)orderItemId);
875            }
876    
877            /**
878             * Returns the shopping order item 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 order item
881             * @return the shopping order item, or <code>null</code> if a shopping order item with the primary key could not be found
882             */
883            @Override
884            public ShoppingOrderItem fetchByPrimaryKey(Serializable primaryKey) {
885                    ShoppingOrderItem shoppingOrderItem = (ShoppingOrderItem)EntityCacheUtil.getResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
886                                    ShoppingOrderItemImpl.class, primaryKey);
887    
888                    if (shoppingOrderItem == _nullShoppingOrderItem) {
889                            return null;
890                    }
891    
892                    if (shoppingOrderItem == null) {
893                            Session session = null;
894    
895                            try {
896                                    session = openSession();
897    
898                                    shoppingOrderItem = (ShoppingOrderItem)session.get(ShoppingOrderItemImpl.class,
899                                                    primaryKey);
900    
901                                    if (shoppingOrderItem != null) {
902                                            cacheResult(shoppingOrderItem);
903                                    }
904                                    else {
905                                            EntityCacheUtil.putResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
906                                                    ShoppingOrderItemImpl.class, primaryKey,
907                                                    _nullShoppingOrderItem);
908                                    }
909                            }
910                            catch (Exception e) {
911                                    EntityCacheUtil.removeResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
912                                            ShoppingOrderItemImpl.class, primaryKey);
913    
914                                    throw processException(e);
915                            }
916                            finally {
917                                    closeSession(session);
918                            }
919                    }
920    
921                    return shoppingOrderItem;
922            }
923    
924            /**
925             * Returns the shopping order item with the primary key or returns <code>null</code> if it could not be found.
926             *
927             * @param orderItemId the primary key of the shopping order item
928             * @return the shopping order item, or <code>null</code> if a shopping order item with the primary key could not be found
929             */
930            @Override
931            public ShoppingOrderItem fetchByPrimaryKey(long orderItemId) {
932                    return fetchByPrimaryKey((Serializable)orderItemId);
933            }
934    
935            @Override
936            public Map<Serializable, ShoppingOrderItem> fetchByPrimaryKeys(
937                    Set<Serializable> primaryKeys) {
938                    if (primaryKeys.isEmpty()) {
939                            return Collections.emptyMap();
940                    }
941    
942                    Map<Serializable, ShoppingOrderItem> map = new HashMap<Serializable, ShoppingOrderItem>();
943    
944                    if (primaryKeys.size() == 1) {
945                            Iterator<Serializable> iterator = primaryKeys.iterator();
946    
947                            Serializable primaryKey = iterator.next();
948    
949                            ShoppingOrderItem shoppingOrderItem = fetchByPrimaryKey(primaryKey);
950    
951                            if (shoppingOrderItem != null) {
952                                    map.put(primaryKey, shoppingOrderItem);
953                            }
954    
955                            return map;
956                    }
957    
958                    Set<Serializable> uncachedPrimaryKeys = null;
959    
960                    for (Serializable primaryKey : primaryKeys) {
961                            ShoppingOrderItem shoppingOrderItem = (ShoppingOrderItem)EntityCacheUtil.getResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
962                                            ShoppingOrderItemImpl.class, primaryKey);
963    
964                            if (shoppingOrderItem == null) {
965                                    if (uncachedPrimaryKeys == null) {
966                                            uncachedPrimaryKeys = new HashSet<Serializable>();
967                                    }
968    
969                                    uncachedPrimaryKeys.add(primaryKey);
970                            }
971                            else {
972                                    map.put(primaryKey, shoppingOrderItem);
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_SHOPPINGORDERITEM_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 (ShoppingOrderItem shoppingOrderItem : (List<ShoppingOrderItem>)q.list()) {
1005                                    map.put(shoppingOrderItem.getPrimaryKeyObj(), shoppingOrderItem);
1006    
1007                                    cacheResult(shoppingOrderItem);
1008    
1009                                    uncachedPrimaryKeys.remove(shoppingOrderItem.getPrimaryKeyObj());
1010                            }
1011    
1012                            for (Serializable primaryKey : uncachedPrimaryKeys) {
1013                                    EntityCacheUtil.putResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
1014                                            ShoppingOrderItemImpl.class, primaryKey,
1015                                            _nullShoppingOrderItem);
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 order items.
1030             *
1031             * @return the shopping order items
1032             */
1033            @Override
1034            public List<ShoppingOrderItem> findAll() {
1035                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1036            }
1037    
1038            /**
1039             * Returns a range of all the shopping order items.
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 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 ShoppingOrderItemModelImpl}. 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 order items
1046             * @param end the upper bound of the range of shopping order items (not inclusive)
1047             * @return the range of shopping order items
1048             */
1049            @Override
1050            public List<ShoppingOrderItem> findAll(int start, int end) {
1051                    return findAll(start, end, null);
1052            }
1053    
1054            /**
1055             * Returns an ordered range of all the shopping order items.
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 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 ShoppingOrderItemModelImpl}. 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 order items
1062             * @param end the upper bound of the range of shopping order items (not inclusive)
1063             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1064             * @return the ordered range of shopping order items
1065             */
1066            @Override
1067            public List<ShoppingOrderItem> findAll(int start, int end,
1068                    OrderByComparator<ShoppingOrderItem> 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<ShoppingOrderItem> list = (List<ShoppingOrderItem>)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_SHOPPINGORDERITEM);
1096    
1097                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1098                                            orderByComparator);
1099    
1100                                    sql = query.toString();
1101                            }
1102                            else {
1103                                    sql = _SQL_SELECT_SHOPPINGORDERITEM;
1104    
1105                                    if (pagination) {
1106                                            sql = sql.concat(ShoppingOrderItemModelImpl.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<ShoppingOrderItem>)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<ShoppingOrderItem>)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 order items from the database.
1149             *
1150             */
1151            @Override
1152            public void removeAll() {
1153                    for (ShoppingOrderItem shoppingOrderItem : findAll()) {
1154                            remove(shoppingOrderItem);
1155                    }
1156            }
1157    
1158            /**
1159             * Returns the number of shopping order items.
1160             *
1161             * @return the number of shopping order items
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_SHOPPINGORDERITEM);
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            /**
1196             * Initializes the shopping order item persistence.
1197             */
1198            public void afterPropertiesSet() {
1199            }
1200    
1201            public void destroy() {
1202                    EntityCacheUtil.removeCache(ShoppingOrderItemImpl.class.getName());
1203                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1204                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1205                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1206            }
1207    
1208            private static final String _SQL_SELECT_SHOPPINGORDERITEM = "SELECT shoppingOrderItem FROM ShoppingOrderItem shoppingOrderItem";
1209            private static final String _SQL_SELECT_SHOPPINGORDERITEM_WHERE_PKS_IN = "SELECT shoppingOrderItem FROM ShoppingOrderItem shoppingOrderItem WHERE orderItemId IN (";
1210            private static final String _SQL_SELECT_SHOPPINGORDERITEM_WHERE = "SELECT shoppingOrderItem FROM ShoppingOrderItem shoppingOrderItem WHERE ";
1211            private static final String _SQL_COUNT_SHOPPINGORDERITEM = "SELECT COUNT(shoppingOrderItem) FROM ShoppingOrderItem shoppingOrderItem";
1212            private static final String _SQL_COUNT_SHOPPINGORDERITEM_WHERE = "SELECT COUNT(shoppingOrderItem) FROM ShoppingOrderItem shoppingOrderItem WHERE ";
1213            private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingOrderItem.";
1214            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingOrderItem exists with the primary key ";
1215            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingOrderItem exists with the key {";
1216            private static final Log _log = LogFactoryUtil.getLog(ShoppingOrderItemPersistenceImpl.class);
1217            private static final ShoppingOrderItem _nullShoppingOrderItem = new ShoppingOrderItemImpl() {
1218                            @Override
1219                            public Object clone() {
1220                                    return this;
1221                            }
1222    
1223                            @Override
1224                            public CacheModel<ShoppingOrderItem> toCacheModel() {
1225                                    return _nullShoppingOrderItemCacheModel;
1226                            }
1227                    };
1228    
1229            private static final CacheModel<ShoppingOrderItem> _nullShoppingOrderItemCacheModel =
1230                    new CacheModel<ShoppingOrderItem>() {
1231                            @Override
1232                            public ShoppingOrderItem toEntityModel() {
1233                                    return _nullShoppingOrderItem;
1234                            }
1235                    };
1236    }