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