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            public ShoppingOrderItemPersistenceImpl() {
581                    setModelClass(ShoppingOrderItem.class);
582            }
583    
584            /**
585             * Caches the shopping order item in the entity cache if it is enabled.
586             *
587             * @param shoppingOrderItem the shopping order item
588             */
589            @Override
590            public void cacheResult(ShoppingOrderItem shoppingOrderItem) {
591                    EntityCacheUtil.putResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
592                            ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey(),
593                            shoppingOrderItem);
594    
595                    shoppingOrderItem.resetOriginalValues();
596            }
597    
598            /**
599             * Caches the shopping order items in the entity cache if it is enabled.
600             *
601             * @param shoppingOrderItems the shopping order items
602             */
603            @Override
604            public void cacheResult(List<ShoppingOrderItem> shoppingOrderItems) {
605                    for (ShoppingOrderItem shoppingOrderItem : shoppingOrderItems) {
606                            if (EntityCacheUtil.getResult(
607                                                    ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
608                                                    ShoppingOrderItemImpl.class,
609                                                    shoppingOrderItem.getPrimaryKey()) == null) {
610                                    cacheResult(shoppingOrderItem);
611                            }
612                            else {
613                                    shoppingOrderItem.resetOriginalValues();
614                            }
615                    }
616            }
617    
618            /**
619             * Clears the cache for all shopping order items.
620             *
621             * <p>
622             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
623             * </p>
624             */
625            @Override
626            public void clearCache() {
627                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
628                            CacheRegistryUtil.clear(ShoppingOrderItemImpl.class.getName());
629                    }
630    
631                    EntityCacheUtil.clearCache(ShoppingOrderItemImpl.class.getName());
632    
633                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
634                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
635                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
636            }
637    
638            /**
639             * Clears the cache for the shopping order item.
640             *
641             * <p>
642             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
643             * </p>
644             */
645            @Override
646            public void clearCache(ShoppingOrderItem shoppingOrderItem) {
647                    EntityCacheUtil.removeResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
648                            ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey());
649    
650                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
651                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
652            }
653    
654            @Override
655            public void clearCache(List<ShoppingOrderItem> shoppingOrderItems) {
656                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
657                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
658    
659                    for (ShoppingOrderItem shoppingOrderItem : shoppingOrderItems) {
660                            EntityCacheUtil.removeResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
661                                    ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey());
662                    }
663            }
664    
665            /**
666             * Creates a new shopping order item with the primary key. Does not add the shopping order item to the database.
667             *
668             * @param orderItemId the primary key for the new shopping order item
669             * @return the new shopping order item
670             */
671            @Override
672            public ShoppingOrderItem create(long orderItemId) {
673                    ShoppingOrderItem shoppingOrderItem = new ShoppingOrderItemImpl();
674    
675                    shoppingOrderItem.setNew(true);
676                    shoppingOrderItem.setPrimaryKey(orderItemId);
677    
678                    return shoppingOrderItem;
679            }
680    
681            /**
682             * Removes the shopping order item with the primary key from the database. Also notifies the appropriate model listeners.
683             *
684             * @param orderItemId the primary key of the shopping order item
685             * @return the shopping order item that was removed
686             * @throws com.liferay.portlet.shopping.NoSuchOrderItemException if a shopping order item with the primary key could not be found
687             * @throws SystemException if a system exception occurred
688             */
689            @Override
690            public ShoppingOrderItem remove(long orderItemId)
691                    throws NoSuchOrderItemException, SystemException {
692                    return remove((Serializable)orderItemId);
693            }
694    
695            /**
696             * Removes the shopping order item with the primary key from the database. Also notifies the appropriate model listeners.
697             *
698             * @param primaryKey the primary key of the shopping order item
699             * @return the shopping order item that was removed
700             * @throws com.liferay.portlet.shopping.NoSuchOrderItemException if a shopping order item with the primary key could not be found
701             * @throws SystemException if a system exception occurred
702             */
703            @Override
704            public ShoppingOrderItem remove(Serializable primaryKey)
705                    throws NoSuchOrderItemException, SystemException {
706                    Session session = null;
707    
708                    try {
709                            session = openSession();
710    
711                            ShoppingOrderItem shoppingOrderItem = (ShoppingOrderItem)session.get(ShoppingOrderItemImpl.class,
712                                            primaryKey);
713    
714                            if (shoppingOrderItem == null) {
715                                    if (_log.isWarnEnabled()) {
716                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
717                                    }
718    
719                                    throw new NoSuchOrderItemException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
720                                            primaryKey);
721                            }
722    
723                            return remove(shoppingOrderItem);
724                    }
725                    catch (NoSuchOrderItemException nsee) {
726                            throw nsee;
727                    }
728                    catch (Exception e) {
729                            throw processException(e);
730                    }
731                    finally {
732                            closeSession(session);
733                    }
734            }
735    
736            @Override
737            protected ShoppingOrderItem removeImpl(ShoppingOrderItem shoppingOrderItem)
738                    throws SystemException {
739                    shoppingOrderItem = toUnwrappedModel(shoppingOrderItem);
740    
741                    Session session = null;
742    
743                    try {
744                            session = openSession();
745    
746                            if (!session.contains(shoppingOrderItem)) {
747                                    shoppingOrderItem = (ShoppingOrderItem)session.get(ShoppingOrderItemImpl.class,
748                                                    shoppingOrderItem.getPrimaryKeyObj());
749                            }
750    
751                            if (shoppingOrderItem != null) {
752                                    session.delete(shoppingOrderItem);
753                            }
754                    }
755                    catch (Exception e) {
756                            throw processException(e);
757                    }
758                    finally {
759                            closeSession(session);
760                    }
761    
762                    if (shoppingOrderItem != null) {
763                            clearCache(shoppingOrderItem);
764                    }
765    
766                    return shoppingOrderItem;
767            }
768    
769            @Override
770            public ShoppingOrderItem updateImpl(
771                    com.liferay.portlet.shopping.model.ShoppingOrderItem shoppingOrderItem)
772                    throws SystemException {
773                    shoppingOrderItem = toUnwrappedModel(shoppingOrderItem);
774    
775                    boolean isNew = shoppingOrderItem.isNew();
776    
777                    ShoppingOrderItemModelImpl shoppingOrderItemModelImpl = (ShoppingOrderItemModelImpl)shoppingOrderItem;
778    
779                    Session session = null;
780    
781                    try {
782                            session = openSession();
783    
784                            if (shoppingOrderItem.isNew()) {
785                                    session.save(shoppingOrderItem);
786    
787                                    shoppingOrderItem.setNew(false);
788                            }
789                            else {
790                                    session.merge(shoppingOrderItem);
791                            }
792                    }
793                    catch (Exception e) {
794                            throw processException(e);
795                    }
796                    finally {
797                            closeSession(session);
798                    }
799    
800                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
801    
802                    if (isNew || !ShoppingOrderItemModelImpl.COLUMN_BITMASK_ENABLED) {
803                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
804                    }
805    
806                    else {
807                            if ((shoppingOrderItemModelImpl.getColumnBitmask() &
808                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ORDERID.getColumnBitmask()) != 0) {
809                                    Object[] args = new Object[] {
810                                                    shoppingOrderItemModelImpl.getOriginalOrderId()
811                                            };
812    
813                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ORDERID, args);
814                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ORDERID,
815                                            args);
816    
817                                    args = new Object[] { shoppingOrderItemModelImpl.getOrderId() };
818    
819                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ORDERID, args);
820                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ORDERID,
821                                            args);
822                            }
823                    }
824    
825                    EntityCacheUtil.putResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
826                            ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey(),
827                            shoppingOrderItem);
828    
829                    return shoppingOrderItem;
830            }
831    
832            protected ShoppingOrderItem toUnwrappedModel(
833                    ShoppingOrderItem shoppingOrderItem) {
834                    if (shoppingOrderItem instanceof ShoppingOrderItemImpl) {
835                            return shoppingOrderItem;
836                    }
837    
838                    ShoppingOrderItemImpl shoppingOrderItemImpl = new ShoppingOrderItemImpl();
839    
840                    shoppingOrderItemImpl.setNew(shoppingOrderItem.isNew());
841                    shoppingOrderItemImpl.setPrimaryKey(shoppingOrderItem.getPrimaryKey());
842    
843                    shoppingOrderItemImpl.setOrderItemId(shoppingOrderItem.getOrderItemId());
844                    shoppingOrderItemImpl.setOrderId(shoppingOrderItem.getOrderId());
845                    shoppingOrderItemImpl.setItemId(shoppingOrderItem.getItemId());
846                    shoppingOrderItemImpl.setSku(shoppingOrderItem.getSku());
847                    shoppingOrderItemImpl.setName(shoppingOrderItem.getName());
848                    shoppingOrderItemImpl.setDescription(shoppingOrderItem.getDescription());
849                    shoppingOrderItemImpl.setProperties(shoppingOrderItem.getProperties());
850                    shoppingOrderItemImpl.setPrice(shoppingOrderItem.getPrice());
851                    shoppingOrderItemImpl.setQuantity(shoppingOrderItem.getQuantity());
852                    shoppingOrderItemImpl.setShippedDate(shoppingOrderItem.getShippedDate());
853    
854                    return shoppingOrderItemImpl;
855            }
856    
857            /**
858             * Returns the shopping order item with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
859             *
860             * @param primaryKey the primary key of the shopping order item
861             * @return the shopping order item
862             * @throws com.liferay.portlet.shopping.NoSuchOrderItemException if a shopping order item with the primary key could not be found
863             * @throws SystemException if a system exception occurred
864             */
865            @Override
866            public ShoppingOrderItem findByPrimaryKey(Serializable primaryKey)
867                    throws NoSuchOrderItemException, SystemException {
868                    ShoppingOrderItem shoppingOrderItem = fetchByPrimaryKey(primaryKey);
869    
870                    if (shoppingOrderItem == null) {
871                            if (_log.isWarnEnabled()) {
872                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
873                            }
874    
875                            throw new NoSuchOrderItemException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
876                                    primaryKey);
877                    }
878    
879                    return shoppingOrderItem;
880            }
881    
882            /**
883             * Returns the shopping order item with the primary key or throws a {@link com.liferay.portlet.shopping.NoSuchOrderItemException} if it could not be found.
884             *
885             * @param orderItemId the primary key of the shopping order item
886             * @return the shopping order item
887             * @throws com.liferay.portlet.shopping.NoSuchOrderItemException if a shopping order item with the primary key could not be found
888             * @throws SystemException if a system exception occurred
889             */
890            @Override
891            public ShoppingOrderItem findByPrimaryKey(long orderItemId)
892                    throws NoSuchOrderItemException, SystemException {
893                    return findByPrimaryKey((Serializable)orderItemId);
894            }
895    
896            /**
897             * Returns the shopping order item with the primary key or returns <code>null</code> if it could not be found.
898             *
899             * @param primaryKey the primary key of the shopping order item
900             * @return the shopping order item, or <code>null</code> if a shopping order item with the primary key could not be found
901             * @throws SystemException if a system exception occurred
902             */
903            @Override
904            public ShoppingOrderItem fetchByPrimaryKey(Serializable primaryKey)
905                    throws SystemException {
906                    ShoppingOrderItem shoppingOrderItem = (ShoppingOrderItem)EntityCacheUtil.getResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
907                                    ShoppingOrderItemImpl.class, primaryKey);
908    
909                    if (shoppingOrderItem == _nullShoppingOrderItem) {
910                            return null;
911                    }
912    
913                    if (shoppingOrderItem == null) {
914                            Session session = null;
915    
916                            try {
917                                    session = openSession();
918    
919                                    shoppingOrderItem = (ShoppingOrderItem)session.get(ShoppingOrderItemImpl.class,
920                                                    primaryKey);
921    
922                                    if (shoppingOrderItem != null) {
923                                            cacheResult(shoppingOrderItem);
924                                    }
925                                    else {
926                                            EntityCacheUtil.putResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
927                                                    ShoppingOrderItemImpl.class, primaryKey,
928                                                    _nullShoppingOrderItem);
929                                    }
930                            }
931                            catch (Exception e) {
932                                    EntityCacheUtil.removeResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
933                                            ShoppingOrderItemImpl.class, primaryKey);
934    
935                                    throw processException(e);
936                            }
937                            finally {
938                                    closeSession(session);
939                            }
940                    }
941    
942                    return shoppingOrderItem;
943            }
944    
945            /**
946             * Returns the shopping order item with the primary key or returns <code>null</code> if it could not be found.
947             *
948             * @param orderItemId the primary key of the shopping order item
949             * @return the shopping order item, or <code>null</code> if a shopping order item with the primary key could not be found
950             * @throws SystemException if a system exception occurred
951             */
952            @Override
953            public ShoppingOrderItem fetchByPrimaryKey(long orderItemId)
954                    throws SystemException {
955                    return fetchByPrimaryKey((Serializable)orderItemId);
956            }
957    
958            /**
959             * Returns all the shopping order items.
960             *
961             * @return the shopping order items
962             * @throws SystemException if a system exception occurred
963             */
964            @Override
965            public List<ShoppingOrderItem> findAll() throws SystemException {
966                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
967            }
968    
969            /**
970             * Returns a range of all the shopping order items.
971             *
972             * <p>
973             * 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.
974             * </p>
975             *
976             * @param start the lower bound of the range of shopping order items
977             * @param end the upper bound of the range of shopping order items (not inclusive)
978             * @return the range of shopping order items
979             * @throws SystemException if a system exception occurred
980             */
981            @Override
982            public List<ShoppingOrderItem> findAll(int start, int end)
983                    throws SystemException {
984                    return findAll(start, end, null);
985            }
986    
987            /**
988             * Returns an ordered range of all the shopping order items.
989             *
990             * <p>
991             * 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.
992             * </p>
993             *
994             * @param start the lower bound of the range of shopping order items
995             * @param end the upper bound of the range of shopping order items (not inclusive)
996             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
997             * @return the ordered range of shopping order items
998             * @throws SystemException if a system exception occurred
999             */
1000            @Override
1001            public List<ShoppingOrderItem> findAll(int start, int end,
1002                    OrderByComparator orderByComparator) throws SystemException {
1003                    boolean pagination = true;
1004                    FinderPath finderPath = null;
1005                    Object[] finderArgs = null;
1006    
1007                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1008                                    (orderByComparator == null)) {
1009                            pagination = false;
1010                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1011                            finderArgs = FINDER_ARGS_EMPTY;
1012                    }
1013                    else {
1014                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1015                            finderArgs = new Object[] { start, end, orderByComparator };
1016                    }
1017    
1018                    List<ShoppingOrderItem> list = (List<ShoppingOrderItem>)FinderCacheUtil.getResult(finderPath,
1019                                    finderArgs, this);
1020    
1021                    if (list == null) {
1022                            StringBundler query = null;
1023                            String sql = null;
1024    
1025                            if (orderByComparator != null) {
1026                                    query = new StringBundler(2 +
1027                                                    (orderByComparator.getOrderByFields().length * 3));
1028    
1029                                    query.append(_SQL_SELECT_SHOPPINGORDERITEM);
1030    
1031                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1032                                            orderByComparator);
1033    
1034                                    sql = query.toString();
1035                            }
1036                            else {
1037                                    sql = _SQL_SELECT_SHOPPINGORDERITEM;
1038    
1039                                    if (pagination) {
1040                                            sql = sql.concat(ShoppingOrderItemModelImpl.ORDER_BY_JPQL);
1041                                    }
1042                            }
1043    
1044                            Session session = null;
1045    
1046                            try {
1047                                    session = openSession();
1048    
1049                                    Query q = session.createQuery(sql);
1050    
1051                                    if (!pagination) {
1052                                            list = (List<ShoppingOrderItem>)QueryUtil.list(q,
1053                                                            getDialect(), start, end, false);
1054    
1055                                            Collections.sort(list);
1056    
1057                                            list = new UnmodifiableList<ShoppingOrderItem>(list);
1058                                    }
1059                                    else {
1060                                            list = (List<ShoppingOrderItem>)QueryUtil.list(q,
1061                                                            getDialect(), start, end);
1062                                    }
1063    
1064                                    cacheResult(list);
1065    
1066                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
1067                            }
1068                            catch (Exception e) {
1069                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1070    
1071                                    throw processException(e);
1072                            }
1073                            finally {
1074                                    closeSession(session);
1075                            }
1076                    }
1077    
1078                    return list;
1079            }
1080    
1081            /**
1082             * Removes all the shopping order items from the database.
1083             *
1084             * @throws SystemException if a system exception occurred
1085             */
1086            @Override
1087            public void removeAll() throws SystemException {
1088                    for (ShoppingOrderItem shoppingOrderItem : findAll()) {
1089                            remove(shoppingOrderItem);
1090                    }
1091            }
1092    
1093            /**
1094             * Returns the number of shopping order items.
1095             *
1096             * @return the number of shopping order items
1097             * @throws SystemException if a system exception occurred
1098             */
1099            @Override
1100            public int countAll() throws SystemException {
1101                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1102                                    FINDER_ARGS_EMPTY, this);
1103    
1104                    if (count == null) {
1105                            Session session = null;
1106    
1107                            try {
1108                                    session = openSession();
1109    
1110                                    Query q = session.createQuery(_SQL_COUNT_SHOPPINGORDERITEM);
1111    
1112                                    count = (Long)q.uniqueResult();
1113    
1114                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1115                                            FINDER_ARGS_EMPTY, count);
1116                            }
1117                            catch (Exception e) {
1118                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
1119                                            FINDER_ARGS_EMPTY);
1120    
1121                                    throw processException(e);
1122                            }
1123                            finally {
1124                                    closeSession(session);
1125                            }
1126                    }
1127    
1128                    return count.intValue();
1129            }
1130    
1131            /**
1132             * Initializes the shopping order item persistence.
1133             */
1134            public void afterPropertiesSet() {
1135                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1136                                            com.liferay.portal.util.PropsUtil.get(
1137                                                    "value.object.listener.com.liferay.portlet.shopping.model.ShoppingOrderItem")));
1138    
1139                    if (listenerClassNames.length > 0) {
1140                            try {
1141                                    List<ModelListener<ShoppingOrderItem>> listenersList = new ArrayList<ModelListener<ShoppingOrderItem>>();
1142    
1143                                    for (String listenerClassName : listenerClassNames) {
1144                                            listenersList.add((ModelListener<ShoppingOrderItem>)InstanceFactory.newInstance(
1145                                                            getClassLoader(), listenerClassName));
1146                                    }
1147    
1148                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1149                            }
1150                            catch (Exception e) {
1151                                    _log.error(e);
1152                            }
1153                    }
1154            }
1155    
1156            public void destroy() {
1157                    EntityCacheUtil.removeCache(ShoppingOrderItemImpl.class.getName());
1158                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1159                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1160                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1161            }
1162    
1163            private static final String _SQL_SELECT_SHOPPINGORDERITEM = "SELECT shoppingOrderItem FROM ShoppingOrderItem shoppingOrderItem";
1164            private static final String _SQL_SELECT_SHOPPINGORDERITEM_WHERE = "SELECT shoppingOrderItem FROM ShoppingOrderItem shoppingOrderItem WHERE ";
1165            private static final String _SQL_COUNT_SHOPPINGORDERITEM = "SELECT COUNT(shoppingOrderItem) FROM ShoppingOrderItem shoppingOrderItem";
1166            private static final String _SQL_COUNT_SHOPPINGORDERITEM_WHERE = "SELECT COUNT(shoppingOrderItem) FROM ShoppingOrderItem shoppingOrderItem WHERE ";
1167            private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingOrderItem.";
1168            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingOrderItem exists with the primary key ";
1169            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingOrderItem exists with the key {";
1170            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1171            private static Log _log = LogFactoryUtil.getLog(ShoppingOrderItemPersistenceImpl.class);
1172            private static ShoppingOrderItem _nullShoppingOrderItem = new ShoppingOrderItemImpl() {
1173                            @Override
1174                            public Object clone() {
1175                                    return this;
1176                            }
1177    
1178                            @Override
1179                            public CacheModel<ShoppingOrderItem> toCacheModel() {
1180                                    return _nullShoppingOrderItemCacheModel;
1181                            }
1182                    };
1183    
1184            private static CacheModel<ShoppingOrderItem> _nullShoppingOrderItemCacheModel =
1185                    new CacheModel<ShoppingOrderItem>() {
1186                            @Override
1187                            public ShoppingOrderItem toEntityModel() {
1188                                    return _nullShoppingOrderItem;
1189                            }
1190                    };
1191    }