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