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