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