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