001
014
015 package com.liferay.portlet.shopping.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.annotation.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.GetterUtil;
031 import com.liferay.portal.kernel.util.InstanceFactory;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.kernel.util.StringUtil;
036 import com.liferay.portal.model.ModelListener;
037 import com.liferay.portal.service.persistence.BatchSessionUtil;
038 import com.liferay.portal.service.persistence.ResourcePersistence;
039 import com.liferay.portal.service.persistence.UserPersistence;
040 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
041
042 import com.liferay.portlet.shopping.NoSuchItemPriceException;
043 import com.liferay.portlet.shopping.model.ShoppingItemPrice;
044 import com.liferay.portlet.shopping.model.impl.ShoppingItemPriceImpl;
045 import com.liferay.portlet.shopping.model.impl.ShoppingItemPriceModelImpl;
046
047 import java.io.Serializable;
048
049 import java.util.ArrayList;
050 import java.util.Collections;
051 import java.util.List;
052
053
059 public class ShoppingItemPricePersistenceImpl extends BasePersistenceImpl<ShoppingItemPrice>
060 implements ShoppingItemPricePersistence {
061 public static final String FINDER_CLASS_NAME_ENTITY = ShoppingItemPriceImpl.class.getName();
062 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
063 ".List";
064 public static final FinderPath FINDER_PATH_FIND_BY_ITEMID = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
065 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
066 FINDER_CLASS_NAME_LIST, "findByItemId",
067 new String[] {
068 Long.class.getName(),
069
070 "java.lang.Integer", "java.lang.Integer",
071 "com.liferay.portal.kernel.util.OrderByComparator"
072 });
073 public static final FinderPath FINDER_PATH_COUNT_BY_ITEMID = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
074 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
075 FINDER_CLASS_NAME_LIST, "countByItemId",
076 new String[] { Long.class.getName() });
077 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
078 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
079 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
080 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
081 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
082 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
083
084 public void cacheResult(ShoppingItemPrice shoppingItemPrice) {
085 EntityCacheUtil.putResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
086 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey(),
087 shoppingItemPrice);
088 }
089
090 public void cacheResult(List<ShoppingItemPrice> shoppingItemPrices) {
091 for (ShoppingItemPrice shoppingItemPrice : shoppingItemPrices) {
092 if (EntityCacheUtil.getResult(
093 ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
094 ShoppingItemPriceImpl.class,
095 shoppingItemPrice.getPrimaryKey(), this) == null) {
096 cacheResult(shoppingItemPrice);
097 }
098 }
099 }
100
101 public void clearCache() {
102 CacheRegistryUtil.clear(ShoppingItemPriceImpl.class.getName());
103 EntityCacheUtil.clearCache(ShoppingItemPriceImpl.class.getName());
104 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
105 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
106 }
107
108 public void clearCache(ShoppingItemPrice shoppingItemPrice) {
109 EntityCacheUtil.removeResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
110 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey());
111 }
112
113 public ShoppingItemPrice create(long itemPriceId) {
114 ShoppingItemPrice shoppingItemPrice = new ShoppingItemPriceImpl();
115
116 shoppingItemPrice.setNew(true);
117 shoppingItemPrice.setPrimaryKey(itemPriceId);
118
119 return shoppingItemPrice;
120 }
121
122 public ShoppingItemPrice remove(Serializable primaryKey)
123 throws NoSuchModelException, SystemException {
124 return remove(((Long)primaryKey).longValue());
125 }
126
127 public ShoppingItemPrice remove(long itemPriceId)
128 throws NoSuchItemPriceException, SystemException {
129 Session session = null;
130
131 try {
132 session = openSession();
133
134 ShoppingItemPrice shoppingItemPrice = (ShoppingItemPrice)session.get(ShoppingItemPriceImpl.class,
135 new Long(itemPriceId));
136
137 if (shoppingItemPrice == null) {
138 if (_log.isWarnEnabled()) {
139 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + itemPriceId);
140 }
141
142 throw new NoSuchItemPriceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
143 itemPriceId);
144 }
145
146 return remove(shoppingItemPrice);
147 }
148 catch (NoSuchItemPriceException nsee) {
149 throw nsee;
150 }
151 catch (Exception e) {
152 throw processException(e);
153 }
154 finally {
155 closeSession(session);
156 }
157 }
158
159 protected ShoppingItemPrice removeImpl(ShoppingItemPrice shoppingItemPrice)
160 throws SystemException {
161 shoppingItemPrice = toUnwrappedModel(shoppingItemPrice);
162
163 Session session = null;
164
165 try {
166 session = openSession();
167
168 if (shoppingItemPrice.isCachedModel() ||
169 BatchSessionUtil.isEnabled()) {
170 Object staleObject = session.get(ShoppingItemPriceImpl.class,
171 shoppingItemPrice.getPrimaryKeyObj());
172
173 if (staleObject != null) {
174 session.evict(staleObject);
175 }
176 }
177
178 session.delete(shoppingItemPrice);
179
180 session.flush();
181 }
182 catch (Exception e) {
183 throw processException(e);
184 }
185 finally {
186 closeSession(session);
187 }
188
189 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
190
191 EntityCacheUtil.removeResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
192 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey());
193
194 return shoppingItemPrice;
195 }
196
197 public ShoppingItemPrice updateImpl(
198 com.liferay.portlet.shopping.model.ShoppingItemPrice shoppingItemPrice,
199 boolean merge) throws SystemException {
200 shoppingItemPrice = toUnwrappedModel(shoppingItemPrice);
201
202 Session session = null;
203
204 try {
205 session = openSession();
206
207 BatchSessionUtil.update(session, shoppingItemPrice, merge);
208
209 shoppingItemPrice.setNew(false);
210 }
211 catch (Exception e) {
212 throw processException(e);
213 }
214 finally {
215 closeSession(session);
216 }
217
218 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
219
220 EntityCacheUtil.putResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
221 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey(),
222 shoppingItemPrice);
223
224 return shoppingItemPrice;
225 }
226
227 protected ShoppingItemPrice toUnwrappedModel(
228 ShoppingItemPrice shoppingItemPrice) {
229 if (shoppingItemPrice instanceof ShoppingItemPriceImpl) {
230 return shoppingItemPrice;
231 }
232
233 ShoppingItemPriceImpl shoppingItemPriceImpl = new ShoppingItemPriceImpl();
234
235 shoppingItemPriceImpl.setNew(shoppingItemPrice.isNew());
236 shoppingItemPriceImpl.setPrimaryKey(shoppingItemPrice.getPrimaryKey());
237
238 shoppingItemPriceImpl.setItemPriceId(shoppingItemPrice.getItemPriceId());
239 shoppingItemPriceImpl.setItemId(shoppingItemPrice.getItemId());
240 shoppingItemPriceImpl.setMinQuantity(shoppingItemPrice.getMinQuantity());
241 shoppingItemPriceImpl.setMaxQuantity(shoppingItemPrice.getMaxQuantity());
242 shoppingItemPriceImpl.setPrice(shoppingItemPrice.getPrice());
243 shoppingItemPriceImpl.setDiscount(shoppingItemPrice.getDiscount());
244 shoppingItemPriceImpl.setTaxable(shoppingItemPrice.isTaxable());
245 shoppingItemPriceImpl.setShipping(shoppingItemPrice.getShipping());
246 shoppingItemPriceImpl.setUseShippingFormula(shoppingItemPrice.isUseShippingFormula());
247 shoppingItemPriceImpl.setStatus(shoppingItemPrice.getStatus());
248
249 return shoppingItemPriceImpl;
250 }
251
252 public ShoppingItemPrice findByPrimaryKey(Serializable primaryKey)
253 throws NoSuchModelException, SystemException {
254 return findByPrimaryKey(((Long)primaryKey).longValue());
255 }
256
257 public ShoppingItemPrice findByPrimaryKey(long itemPriceId)
258 throws NoSuchItemPriceException, SystemException {
259 ShoppingItemPrice shoppingItemPrice = fetchByPrimaryKey(itemPriceId);
260
261 if (shoppingItemPrice == null) {
262 if (_log.isWarnEnabled()) {
263 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + itemPriceId);
264 }
265
266 throw new NoSuchItemPriceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
267 itemPriceId);
268 }
269
270 return shoppingItemPrice;
271 }
272
273 public ShoppingItemPrice fetchByPrimaryKey(Serializable primaryKey)
274 throws SystemException {
275 return fetchByPrimaryKey(((Long)primaryKey).longValue());
276 }
277
278 public ShoppingItemPrice fetchByPrimaryKey(long itemPriceId)
279 throws SystemException {
280 ShoppingItemPrice shoppingItemPrice = (ShoppingItemPrice)EntityCacheUtil.getResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
281 ShoppingItemPriceImpl.class, itemPriceId, this);
282
283 if (shoppingItemPrice == null) {
284 Session session = null;
285
286 try {
287 session = openSession();
288
289 shoppingItemPrice = (ShoppingItemPrice)session.get(ShoppingItemPriceImpl.class,
290 new Long(itemPriceId));
291 }
292 catch (Exception e) {
293 throw processException(e);
294 }
295 finally {
296 if (shoppingItemPrice != null) {
297 cacheResult(shoppingItemPrice);
298 }
299
300 closeSession(session);
301 }
302 }
303
304 return shoppingItemPrice;
305 }
306
307 public List<ShoppingItemPrice> findByItemId(long itemId)
308 throws SystemException {
309 return findByItemId(itemId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
310 }
311
312 public List<ShoppingItemPrice> findByItemId(long itemId, int start, int end)
313 throws SystemException {
314 return findByItemId(itemId, start, end, null);
315 }
316
317 public List<ShoppingItemPrice> findByItemId(long itemId, int start,
318 int end, OrderByComparator orderByComparator) throws SystemException {
319 Object[] finderArgs = new Object[] {
320 itemId,
321
322 String.valueOf(start), String.valueOf(end),
323 String.valueOf(orderByComparator)
324 };
325
326 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ITEMID,
327 finderArgs, this);
328
329 if (list == null) {
330 Session session = null;
331
332 try {
333 session = openSession();
334
335 StringBundler query = null;
336
337 if (orderByComparator != null) {
338 query = new StringBundler(3 +
339 (orderByComparator.getOrderByFields().length * 3));
340 }
341 else {
342 query = new StringBundler(3);
343 }
344
345 query.append(_SQL_SELECT_SHOPPINGITEMPRICE_WHERE);
346
347 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
348
349 if (orderByComparator != null) {
350 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
351 orderByComparator);
352 }
353
354 else {
355 query.append(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
356 }
357
358 String sql = query.toString();
359
360 Query q = session.createQuery(sql);
361
362 QueryPos qPos = QueryPos.getInstance(q);
363
364 qPos.add(itemId);
365
366 list = (List<ShoppingItemPrice>)QueryUtil.list(q, getDialect(),
367 start, end);
368 }
369 catch (Exception e) {
370 throw processException(e);
371 }
372 finally {
373 if (list == null) {
374 list = new ArrayList<ShoppingItemPrice>();
375 }
376
377 cacheResult(list);
378
379 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ITEMID,
380 finderArgs, list);
381
382 closeSession(session);
383 }
384 }
385
386 return list;
387 }
388
389 public ShoppingItemPrice findByItemId_First(long itemId,
390 OrderByComparator orderByComparator)
391 throws NoSuchItemPriceException, SystemException {
392 List<ShoppingItemPrice> list = findByItemId(itemId, 0, 1,
393 orderByComparator);
394
395 if (list.isEmpty()) {
396 StringBundler msg = new StringBundler(4);
397
398 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
399
400 msg.append("itemId=");
401 msg.append(itemId);
402
403 msg.append(StringPool.CLOSE_CURLY_BRACE);
404
405 throw new NoSuchItemPriceException(msg.toString());
406 }
407 else {
408 return list.get(0);
409 }
410 }
411
412 public ShoppingItemPrice findByItemId_Last(long itemId,
413 OrderByComparator orderByComparator)
414 throws NoSuchItemPriceException, SystemException {
415 int count = countByItemId(itemId);
416
417 List<ShoppingItemPrice> list = findByItemId(itemId, count - 1, count,
418 orderByComparator);
419
420 if (list.isEmpty()) {
421 StringBundler msg = new StringBundler(4);
422
423 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
424
425 msg.append("itemId=");
426 msg.append(itemId);
427
428 msg.append(StringPool.CLOSE_CURLY_BRACE);
429
430 throw new NoSuchItemPriceException(msg.toString());
431 }
432 else {
433 return list.get(0);
434 }
435 }
436
437 public ShoppingItemPrice[] findByItemId_PrevAndNext(long itemPriceId,
438 long itemId, OrderByComparator orderByComparator)
439 throws NoSuchItemPriceException, SystemException {
440 ShoppingItemPrice shoppingItemPrice = findByPrimaryKey(itemPriceId);
441
442 Session session = null;
443
444 try {
445 session = openSession();
446
447 ShoppingItemPrice[] array = new ShoppingItemPriceImpl[3];
448
449 array[0] = getByItemId_PrevAndNext(session, shoppingItemPrice,
450 itemId, orderByComparator, true);
451
452 array[1] = shoppingItemPrice;
453
454 array[2] = getByItemId_PrevAndNext(session, shoppingItemPrice,
455 itemId, orderByComparator, false);
456
457 return array;
458 }
459 catch (Exception e) {
460 throw processException(e);
461 }
462 finally {
463 closeSession(session);
464 }
465 }
466
467 protected ShoppingItemPrice getByItemId_PrevAndNext(Session session,
468 ShoppingItemPrice shoppingItemPrice, long itemId,
469 OrderByComparator orderByComparator, boolean previous) {
470 StringBundler query = null;
471
472 if (orderByComparator != null) {
473 query = new StringBundler(6 +
474 (orderByComparator.getOrderByFields().length * 6));
475 }
476 else {
477 query = new StringBundler(3);
478 }
479
480 query.append(_SQL_SELECT_SHOPPINGITEMPRICE_WHERE);
481
482 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
483
484 if (orderByComparator != null) {
485 String[] orderByFields = orderByComparator.getOrderByFields();
486
487 if (orderByFields.length > 0) {
488 query.append(WHERE_AND);
489 }
490
491 for (int i = 0; i < orderByFields.length; i++) {
492 query.append(_ORDER_BY_ENTITY_ALIAS);
493 query.append(orderByFields[i]);
494
495 if ((i + 1) < orderByFields.length) {
496 if (orderByComparator.isAscending() ^ previous) {
497 query.append(WHERE_GREATER_THAN_HAS_NEXT);
498 }
499 else {
500 query.append(WHERE_LESSER_THAN_HAS_NEXT);
501 }
502 }
503 else {
504 if (orderByComparator.isAscending() ^ previous) {
505 query.append(WHERE_GREATER_THAN);
506 }
507 else {
508 query.append(WHERE_LESSER_THAN);
509 }
510 }
511 }
512
513 query.append(ORDER_BY_CLAUSE);
514
515 for (int i = 0; i < orderByFields.length; i++) {
516 query.append(_ORDER_BY_ENTITY_ALIAS);
517 query.append(orderByFields[i]);
518
519 if ((i + 1) < orderByFields.length) {
520 if (orderByComparator.isAscending() ^ previous) {
521 query.append(ORDER_BY_ASC_HAS_NEXT);
522 }
523 else {
524 query.append(ORDER_BY_DESC_HAS_NEXT);
525 }
526 }
527 else {
528 if (orderByComparator.isAscending() ^ previous) {
529 query.append(ORDER_BY_ASC);
530 }
531 else {
532 query.append(ORDER_BY_DESC);
533 }
534 }
535 }
536 }
537
538 else {
539 query.append(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
540 }
541
542 String sql = query.toString();
543
544 Query q = session.createQuery(sql);
545
546 q.setFirstResult(0);
547 q.setMaxResults(2);
548
549 QueryPos qPos = QueryPos.getInstance(q);
550
551 qPos.add(itemId);
552
553 if (orderByComparator != null) {
554 Object[] values = orderByComparator.getOrderByValues(shoppingItemPrice);
555
556 for (Object value : values) {
557 qPos.add(value);
558 }
559 }
560
561 List<ShoppingItemPrice> list = q.list();
562
563 if (list.size() == 2) {
564 return list.get(1);
565 }
566 else {
567 return null;
568 }
569 }
570
571 public List<ShoppingItemPrice> findAll() throws SystemException {
572 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
573 }
574
575 public List<ShoppingItemPrice> findAll(int start, int end)
576 throws SystemException {
577 return findAll(start, end, null);
578 }
579
580 public List<ShoppingItemPrice> findAll(int start, int end,
581 OrderByComparator orderByComparator) throws SystemException {
582 Object[] finderArgs = new Object[] {
583 String.valueOf(start), String.valueOf(end),
584 String.valueOf(orderByComparator)
585 };
586
587 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
588 finderArgs, this);
589
590 if (list == null) {
591 Session session = null;
592
593 try {
594 session = openSession();
595
596 StringBundler query = null;
597 String sql = null;
598
599 if (orderByComparator != null) {
600 query = new StringBundler(2 +
601 (orderByComparator.getOrderByFields().length * 3));
602
603 query.append(_SQL_SELECT_SHOPPINGITEMPRICE);
604
605 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
606 orderByComparator);
607
608 sql = query.toString();
609 }
610 else {
611 sql = _SQL_SELECT_SHOPPINGITEMPRICE.concat(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
612 }
613
614 Query q = session.createQuery(sql);
615
616 if (orderByComparator == null) {
617 list = (List<ShoppingItemPrice>)QueryUtil.list(q,
618 getDialect(), start, end, false);
619
620 Collections.sort(list);
621 }
622 else {
623 list = (List<ShoppingItemPrice>)QueryUtil.list(q,
624 getDialect(), start, end);
625 }
626 }
627 catch (Exception e) {
628 throw processException(e);
629 }
630 finally {
631 if (list == null) {
632 list = new ArrayList<ShoppingItemPrice>();
633 }
634
635 cacheResult(list);
636
637 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
638
639 closeSession(session);
640 }
641 }
642
643 return list;
644 }
645
646 public void removeByItemId(long itemId) throws SystemException {
647 for (ShoppingItemPrice shoppingItemPrice : findByItemId(itemId)) {
648 remove(shoppingItemPrice);
649 }
650 }
651
652 public void removeAll() throws SystemException {
653 for (ShoppingItemPrice shoppingItemPrice : findAll()) {
654 remove(shoppingItemPrice);
655 }
656 }
657
658 public int countByItemId(long itemId) throws SystemException {
659 Object[] finderArgs = new Object[] { itemId };
660
661 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ITEMID,
662 finderArgs, this);
663
664 if (count == null) {
665 Session session = null;
666
667 try {
668 session = openSession();
669
670 StringBundler query = new StringBundler(2);
671
672 query.append(_SQL_COUNT_SHOPPINGITEMPRICE_WHERE);
673
674 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
675
676 String sql = query.toString();
677
678 Query q = session.createQuery(sql);
679
680 QueryPos qPos = QueryPos.getInstance(q);
681
682 qPos.add(itemId);
683
684 count = (Long)q.uniqueResult();
685 }
686 catch (Exception e) {
687 throw processException(e);
688 }
689 finally {
690 if (count == null) {
691 count = Long.valueOf(0);
692 }
693
694 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ITEMID,
695 finderArgs, count);
696
697 closeSession(session);
698 }
699 }
700
701 return count.intValue();
702 }
703
704 public int countAll() throws SystemException {
705 Object[] finderArgs = new Object[0];
706
707 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
708 finderArgs, this);
709
710 if (count == null) {
711 Session session = null;
712
713 try {
714 session = openSession();
715
716 Query q = session.createQuery(_SQL_COUNT_SHOPPINGITEMPRICE);
717
718 count = (Long)q.uniqueResult();
719 }
720 catch (Exception e) {
721 throw processException(e);
722 }
723 finally {
724 if (count == null) {
725 count = Long.valueOf(0);
726 }
727
728 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
729 count);
730
731 closeSession(session);
732 }
733 }
734
735 return count.intValue();
736 }
737
738 public void afterPropertiesSet() {
739 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
740 com.liferay.portal.util.PropsUtil.get(
741 "value.object.listener.com.liferay.portlet.shopping.model.ShoppingItemPrice")));
742
743 if (listenerClassNames.length > 0) {
744 try {
745 List<ModelListener<ShoppingItemPrice>> listenersList = new ArrayList<ModelListener<ShoppingItemPrice>>();
746
747 for (String listenerClassName : listenerClassNames) {
748 listenersList.add((ModelListener<ShoppingItemPrice>)InstanceFactory.newInstance(
749 listenerClassName));
750 }
751
752 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
753 }
754 catch (Exception e) {
755 _log.error(e);
756 }
757 }
758 }
759
760 @BeanReference(type = ShoppingCartPersistence.class)
761 protected ShoppingCartPersistence shoppingCartPersistence;
762 @BeanReference(type = ShoppingCategoryPersistence.class)
763 protected ShoppingCategoryPersistence shoppingCategoryPersistence;
764 @BeanReference(type = ShoppingCouponPersistence.class)
765 protected ShoppingCouponPersistence shoppingCouponPersistence;
766 @BeanReference(type = ShoppingItemPersistence.class)
767 protected ShoppingItemPersistence shoppingItemPersistence;
768 @BeanReference(type = ShoppingItemFieldPersistence.class)
769 protected ShoppingItemFieldPersistence shoppingItemFieldPersistence;
770 @BeanReference(type = ShoppingItemPricePersistence.class)
771 protected ShoppingItemPricePersistence shoppingItemPricePersistence;
772 @BeanReference(type = ShoppingOrderPersistence.class)
773 protected ShoppingOrderPersistence shoppingOrderPersistence;
774 @BeanReference(type = ShoppingOrderItemPersistence.class)
775 protected ShoppingOrderItemPersistence shoppingOrderItemPersistence;
776 @BeanReference(type = ResourcePersistence.class)
777 protected ResourcePersistence resourcePersistence;
778 @BeanReference(type = UserPersistence.class)
779 protected UserPersistence userPersistence;
780 private static final String _SQL_SELECT_SHOPPINGITEMPRICE = "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice";
781 private static final String _SQL_SELECT_SHOPPINGITEMPRICE_WHERE = "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice WHERE ";
782 private static final String _SQL_COUNT_SHOPPINGITEMPRICE = "SELECT COUNT(shoppingItemPrice) FROM ShoppingItemPrice shoppingItemPrice";
783 private static final String _SQL_COUNT_SHOPPINGITEMPRICE_WHERE = "SELECT COUNT(shoppingItemPrice) FROM ShoppingItemPrice shoppingItemPrice WHERE ";
784 private static final String _FINDER_COLUMN_ITEMID_ITEMID_2 = "shoppingItemPrice.itemId = ?";
785 private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingItemPrice.";
786 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingItemPrice exists with the primary key ";
787 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingItemPrice exists with the key {";
788 private static Log _log = LogFactoryUtil.getLog(ShoppingItemPricePersistenceImpl.class);
789 }