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
069 public class ShoppingItemPricePersistenceImpl extends BasePersistenceImpl<ShoppingItemPrice>
070 implements ShoppingItemPricePersistence {
071 public static final String FINDER_CLASS_NAME_ENTITY = ShoppingItemPriceImpl.class.getName();
072 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
073 ".List";
074 public static final FinderPath FINDER_PATH_FIND_BY_ITEMID = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
075 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
076 FINDER_CLASS_NAME_LIST, "findByItemId",
077 new String[] {
078 Long.class.getName(),
079
080 "java.lang.Integer", "java.lang.Integer",
081 "com.liferay.portal.kernel.util.OrderByComparator"
082 });
083 public static final FinderPath FINDER_PATH_COUNT_BY_ITEMID = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
084 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
085 FINDER_CLASS_NAME_LIST, "countByItemId",
086 new String[] { Long.class.getName() });
087 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
088 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
089 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
090 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
091 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
092 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
093
094
099 public void cacheResult(ShoppingItemPrice shoppingItemPrice) {
100 EntityCacheUtil.putResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
101 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey(),
102 shoppingItemPrice);
103 }
104
105
110 public void cacheResult(List<ShoppingItemPrice> shoppingItemPrices) {
111 for (ShoppingItemPrice shoppingItemPrice : shoppingItemPrices) {
112 if (EntityCacheUtil.getResult(
113 ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
114 ShoppingItemPriceImpl.class,
115 shoppingItemPrice.getPrimaryKey(), this) == null) {
116 cacheResult(shoppingItemPrice);
117 }
118 }
119 }
120
121
128 public void clearCache() {
129 CacheRegistryUtil.clear(ShoppingItemPriceImpl.class.getName());
130 EntityCacheUtil.clearCache(ShoppingItemPriceImpl.class.getName());
131 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
132 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
133 }
134
135
142 public void clearCache(ShoppingItemPrice shoppingItemPrice) {
143 EntityCacheUtil.removeResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
144 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey());
145 }
146
147
153 public ShoppingItemPrice create(long itemPriceId) {
154 ShoppingItemPrice shoppingItemPrice = new ShoppingItemPriceImpl();
155
156 shoppingItemPrice.setNew(true);
157 shoppingItemPrice.setPrimaryKey(itemPriceId);
158
159 return shoppingItemPrice;
160 }
161
162
170 public ShoppingItemPrice remove(Serializable primaryKey)
171 throws NoSuchModelException, SystemException {
172 return remove(((Long)primaryKey).longValue());
173 }
174
175
183 public ShoppingItemPrice remove(long itemPriceId)
184 throws NoSuchItemPriceException, SystemException {
185 Session session = null;
186
187 try {
188 session = openSession();
189
190 ShoppingItemPrice shoppingItemPrice = (ShoppingItemPrice)session.get(ShoppingItemPriceImpl.class,
191 new Long(itemPriceId));
192
193 if (shoppingItemPrice == null) {
194 if (_log.isWarnEnabled()) {
195 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + itemPriceId);
196 }
197
198 throw new NoSuchItemPriceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
199 itemPriceId);
200 }
201
202 return remove(shoppingItemPrice);
203 }
204 catch (NoSuchItemPriceException nsee) {
205 throw nsee;
206 }
207 catch (Exception e) {
208 throw processException(e);
209 }
210 finally {
211 closeSession(session);
212 }
213 }
214
215 protected ShoppingItemPrice removeImpl(ShoppingItemPrice shoppingItemPrice)
216 throws SystemException {
217 shoppingItemPrice = toUnwrappedModel(shoppingItemPrice);
218
219 Session session = null;
220
221 try {
222 session = openSession();
223
224 BatchSessionUtil.delete(session, shoppingItemPrice);
225 }
226 catch (Exception e) {
227 throw processException(e);
228 }
229 finally {
230 closeSession(session);
231 }
232
233 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
234
235 EntityCacheUtil.removeResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
236 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey());
237
238 return shoppingItemPrice;
239 }
240
241 public ShoppingItemPrice updateImpl(
242 com.liferay.portlet.shopping.model.ShoppingItemPrice shoppingItemPrice,
243 boolean merge) throws SystemException {
244 shoppingItemPrice = toUnwrappedModel(shoppingItemPrice);
245
246 Session session = null;
247
248 try {
249 session = openSession();
250
251 BatchSessionUtil.update(session, shoppingItemPrice, merge);
252
253 shoppingItemPrice.setNew(false);
254 }
255 catch (Exception e) {
256 throw processException(e);
257 }
258 finally {
259 closeSession(session);
260 }
261
262 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
263
264 EntityCacheUtil.putResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
265 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey(),
266 shoppingItemPrice);
267
268 return shoppingItemPrice;
269 }
270
271 protected ShoppingItemPrice toUnwrappedModel(
272 ShoppingItemPrice shoppingItemPrice) {
273 if (shoppingItemPrice instanceof ShoppingItemPriceImpl) {
274 return shoppingItemPrice;
275 }
276
277 ShoppingItemPriceImpl shoppingItemPriceImpl = new ShoppingItemPriceImpl();
278
279 shoppingItemPriceImpl.setNew(shoppingItemPrice.isNew());
280 shoppingItemPriceImpl.setPrimaryKey(shoppingItemPrice.getPrimaryKey());
281
282 shoppingItemPriceImpl.setItemPriceId(shoppingItemPrice.getItemPriceId());
283 shoppingItemPriceImpl.setItemId(shoppingItemPrice.getItemId());
284 shoppingItemPriceImpl.setMinQuantity(shoppingItemPrice.getMinQuantity());
285 shoppingItemPriceImpl.setMaxQuantity(shoppingItemPrice.getMaxQuantity());
286 shoppingItemPriceImpl.setPrice(shoppingItemPrice.getPrice());
287 shoppingItemPriceImpl.setDiscount(shoppingItemPrice.getDiscount());
288 shoppingItemPriceImpl.setTaxable(shoppingItemPrice.isTaxable());
289 shoppingItemPriceImpl.setShipping(shoppingItemPrice.getShipping());
290 shoppingItemPriceImpl.setUseShippingFormula(shoppingItemPrice.isUseShippingFormula());
291 shoppingItemPriceImpl.setStatus(shoppingItemPrice.getStatus());
292
293 return shoppingItemPriceImpl;
294 }
295
296
304 public ShoppingItemPrice findByPrimaryKey(Serializable primaryKey)
305 throws NoSuchModelException, SystemException {
306 return findByPrimaryKey(((Long)primaryKey).longValue());
307 }
308
309
317 public ShoppingItemPrice findByPrimaryKey(long itemPriceId)
318 throws NoSuchItemPriceException, SystemException {
319 ShoppingItemPrice shoppingItemPrice = fetchByPrimaryKey(itemPriceId);
320
321 if (shoppingItemPrice == null) {
322 if (_log.isWarnEnabled()) {
323 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + itemPriceId);
324 }
325
326 throw new NoSuchItemPriceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
327 itemPriceId);
328 }
329
330 return shoppingItemPrice;
331 }
332
333
340 public ShoppingItemPrice fetchByPrimaryKey(Serializable primaryKey)
341 throws SystemException {
342 return fetchByPrimaryKey(((Long)primaryKey).longValue());
343 }
344
345
352 public ShoppingItemPrice fetchByPrimaryKey(long itemPriceId)
353 throws SystemException {
354 ShoppingItemPrice shoppingItemPrice = (ShoppingItemPrice)EntityCacheUtil.getResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
355 ShoppingItemPriceImpl.class, itemPriceId, this);
356
357 if (shoppingItemPrice == null) {
358 Session session = null;
359
360 try {
361 session = openSession();
362
363 shoppingItemPrice = (ShoppingItemPrice)session.get(ShoppingItemPriceImpl.class,
364 new Long(itemPriceId));
365 }
366 catch (Exception e) {
367 throw processException(e);
368 }
369 finally {
370 if (shoppingItemPrice != null) {
371 cacheResult(shoppingItemPrice);
372 }
373
374 closeSession(session);
375 }
376 }
377
378 return shoppingItemPrice;
379 }
380
381
388 public List<ShoppingItemPrice> findByItemId(long itemId)
389 throws SystemException {
390 return findByItemId(itemId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
391 }
392
393
406 public List<ShoppingItemPrice> findByItemId(long itemId, int start, int end)
407 throws SystemException {
408 return findByItemId(itemId, start, end, null);
409 }
410
411
425 public List<ShoppingItemPrice> findByItemId(long itemId, int start,
426 int end, OrderByComparator orderByComparator) throws SystemException {
427 Object[] finderArgs = new Object[] {
428 itemId,
429
430 String.valueOf(start), String.valueOf(end),
431 String.valueOf(orderByComparator)
432 };
433
434 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ITEMID,
435 finderArgs, this);
436
437 if (list == null) {
438 Session session = null;
439
440 try {
441 session = openSession();
442
443 StringBundler query = null;
444
445 if (orderByComparator != null) {
446 query = new StringBundler(3 +
447 (orderByComparator.getOrderByFields().length * 3));
448 }
449 else {
450 query = new StringBundler(3);
451 }
452
453 query.append(_SQL_SELECT_SHOPPINGITEMPRICE_WHERE);
454
455 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
456
457 if (orderByComparator != null) {
458 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
459 orderByComparator);
460 }
461
462 else {
463 query.append(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
464 }
465
466 String sql = query.toString();
467
468 Query q = session.createQuery(sql);
469
470 QueryPos qPos = QueryPos.getInstance(q);
471
472 qPos.add(itemId);
473
474 list = (List<ShoppingItemPrice>)QueryUtil.list(q, getDialect(),
475 start, end);
476 }
477 catch (Exception e) {
478 throw processException(e);
479 }
480 finally {
481 if (list == null) {
482 list = new ArrayList<ShoppingItemPrice>();
483 }
484
485 cacheResult(list);
486
487 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ITEMID,
488 finderArgs, list);
489
490 closeSession(session);
491 }
492 }
493
494 return list;
495 }
496
497
510 public ShoppingItemPrice findByItemId_First(long itemId,
511 OrderByComparator orderByComparator)
512 throws NoSuchItemPriceException, SystemException {
513 List<ShoppingItemPrice> list = findByItemId(itemId, 0, 1,
514 orderByComparator);
515
516 if (list.isEmpty()) {
517 StringBundler msg = new StringBundler(4);
518
519 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
520
521 msg.append("itemId=");
522 msg.append(itemId);
523
524 msg.append(StringPool.CLOSE_CURLY_BRACE);
525
526 throw new NoSuchItemPriceException(msg.toString());
527 }
528 else {
529 return list.get(0);
530 }
531 }
532
533
546 public ShoppingItemPrice findByItemId_Last(long itemId,
547 OrderByComparator orderByComparator)
548 throws NoSuchItemPriceException, SystemException {
549 int count = countByItemId(itemId);
550
551 List<ShoppingItemPrice> list = findByItemId(itemId, count - 1, count,
552 orderByComparator);
553
554 if (list.isEmpty()) {
555 StringBundler msg = new StringBundler(4);
556
557 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
558
559 msg.append("itemId=");
560 msg.append(itemId);
561
562 msg.append(StringPool.CLOSE_CURLY_BRACE);
563
564 throw new NoSuchItemPriceException(msg.toString());
565 }
566 else {
567 return list.get(0);
568 }
569 }
570
571
585 public ShoppingItemPrice[] findByItemId_PrevAndNext(long itemPriceId,
586 long itemId, OrderByComparator orderByComparator)
587 throws NoSuchItemPriceException, SystemException {
588 ShoppingItemPrice shoppingItemPrice = findByPrimaryKey(itemPriceId);
589
590 Session session = null;
591
592 try {
593 session = openSession();
594
595 ShoppingItemPrice[] array = new ShoppingItemPriceImpl[3];
596
597 array[0] = getByItemId_PrevAndNext(session, shoppingItemPrice,
598 itemId, orderByComparator, true);
599
600 array[1] = shoppingItemPrice;
601
602 array[2] = getByItemId_PrevAndNext(session, shoppingItemPrice,
603 itemId, orderByComparator, false);
604
605 return array;
606 }
607 catch (Exception e) {
608 throw processException(e);
609 }
610 finally {
611 closeSession(session);
612 }
613 }
614
615 protected ShoppingItemPrice getByItemId_PrevAndNext(Session session,
616 ShoppingItemPrice shoppingItemPrice, long itemId,
617 OrderByComparator orderByComparator, boolean previous) {
618 StringBundler query = null;
619
620 if (orderByComparator != null) {
621 query = new StringBundler(6 +
622 (orderByComparator.getOrderByFields().length * 6));
623 }
624 else {
625 query = new StringBundler(3);
626 }
627
628 query.append(_SQL_SELECT_SHOPPINGITEMPRICE_WHERE);
629
630 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
631
632 if (orderByComparator != null) {
633 String[] orderByFields = orderByComparator.getOrderByFields();
634
635 if (orderByFields.length > 0) {
636 query.append(WHERE_AND);
637 }
638
639 for (int i = 0; i < orderByFields.length; i++) {
640 query.append(_ORDER_BY_ENTITY_ALIAS);
641 query.append(orderByFields[i]);
642
643 if ((i + 1) < orderByFields.length) {
644 if (orderByComparator.isAscending() ^ previous) {
645 query.append(WHERE_GREATER_THAN_HAS_NEXT);
646 }
647 else {
648 query.append(WHERE_LESSER_THAN_HAS_NEXT);
649 }
650 }
651 else {
652 if (orderByComparator.isAscending() ^ previous) {
653 query.append(WHERE_GREATER_THAN);
654 }
655 else {
656 query.append(WHERE_LESSER_THAN);
657 }
658 }
659 }
660
661 query.append(ORDER_BY_CLAUSE);
662
663 for (int i = 0; i < orderByFields.length; i++) {
664 query.append(_ORDER_BY_ENTITY_ALIAS);
665 query.append(orderByFields[i]);
666
667 if ((i + 1) < orderByFields.length) {
668 if (orderByComparator.isAscending() ^ previous) {
669 query.append(ORDER_BY_ASC_HAS_NEXT);
670 }
671 else {
672 query.append(ORDER_BY_DESC_HAS_NEXT);
673 }
674 }
675 else {
676 if (orderByComparator.isAscending() ^ previous) {
677 query.append(ORDER_BY_ASC);
678 }
679 else {
680 query.append(ORDER_BY_DESC);
681 }
682 }
683 }
684 }
685
686 else {
687 query.append(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
688 }
689
690 String sql = query.toString();
691
692 Query q = session.createQuery(sql);
693
694 q.setFirstResult(0);
695 q.setMaxResults(2);
696
697 QueryPos qPos = QueryPos.getInstance(q);
698
699 qPos.add(itemId);
700
701 if (orderByComparator != null) {
702 Object[] values = orderByComparator.getOrderByValues(shoppingItemPrice);
703
704 for (Object value : values) {
705 qPos.add(value);
706 }
707 }
708
709 List<ShoppingItemPrice> list = q.list();
710
711 if (list.size() == 2) {
712 return list.get(1);
713 }
714 else {
715 return null;
716 }
717 }
718
719
725 public List<ShoppingItemPrice> findAll() throws SystemException {
726 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
727 }
728
729
741 public List<ShoppingItemPrice> findAll(int start, int end)
742 throws SystemException {
743 return findAll(start, end, null);
744 }
745
746
759 public List<ShoppingItemPrice> findAll(int start, int end,
760 OrderByComparator orderByComparator) throws SystemException {
761 Object[] finderArgs = new Object[] {
762 String.valueOf(start), String.valueOf(end),
763 String.valueOf(orderByComparator)
764 };
765
766 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
767 finderArgs, this);
768
769 if (list == null) {
770 Session session = null;
771
772 try {
773 session = openSession();
774
775 StringBundler query = null;
776 String sql = null;
777
778 if (orderByComparator != null) {
779 query = new StringBundler(2 +
780 (orderByComparator.getOrderByFields().length * 3));
781
782 query.append(_SQL_SELECT_SHOPPINGITEMPRICE);
783
784 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
785 orderByComparator);
786
787 sql = query.toString();
788 }
789 else {
790 sql = _SQL_SELECT_SHOPPINGITEMPRICE.concat(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
791 }
792
793 Query q = session.createQuery(sql);
794
795 if (orderByComparator == null) {
796 list = (List<ShoppingItemPrice>)QueryUtil.list(q,
797 getDialect(), start, end, false);
798
799 Collections.sort(list);
800 }
801 else {
802 list = (List<ShoppingItemPrice>)QueryUtil.list(q,
803 getDialect(), start, end);
804 }
805 }
806 catch (Exception e) {
807 throw processException(e);
808 }
809 finally {
810 if (list == null) {
811 list = new ArrayList<ShoppingItemPrice>();
812 }
813
814 cacheResult(list);
815
816 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
817
818 closeSession(session);
819 }
820 }
821
822 return list;
823 }
824
825
831 public void removeByItemId(long itemId) throws SystemException {
832 for (ShoppingItemPrice shoppingItemPrice : findByItemId(itemId)) {
833 remove(shoppingItemPrice);
834 }
835 }
836
837
842 public void removeAll() throws SystemException {
843 for (ShoppingItemPrice shoppingItemPrice : findAll()) {
844 remove(shoppingItemPrice);
845 }
846 }
847
848
855 public int countByItemId(long itemId) throws SystemException {
856 Object[] finderArgs = new Object[] { itemId };
857
858 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ITEMID,
859 finderArgs, this);
860
861 if (count == null) {
862 Session session = null;
863
864 try {
865 session = openSession();
866
867 StringBundler query = new StringBundler(2);
868
869 query.append(_SQL_COUNT_SHOPPINGITEMPRICE_WHERE);
870
871 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
872
873 String sql = query.toString();
874
875 Query q = session.createQuery(sql);
876
877 QueryPos qPos = QueryPos.getInstance(q);
878
879 qPos.add(itemId);
880
881 count = (Long)q.uniqueResult();
882 }
883 catch (Exception e) {
884 throw processException(e);
885 }
886 finally {
887 if (count == null) {
888 count = Long.valueOf(0);
889 }
890
891 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ITEMID,
892 finderArgs, count);
893
894 closeSession(session);
895 }
896 }
897
898 return count.intValue();
899 }
900
901
907 public int countAll() throws SystemException {
908 Object[] finderArgs = new Object[0];
909
910 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
911 finderArgs, this);
912
913 if (count == null) {
914 Session session = null;
915
916 try {
917 session = openSession();
918
919 Query q = session.createQuery(_SQL_COUNT_SHOPPINGITEMPRICE);
920
921 count = (Long)q.uniqueResult();
922 }
923 catch (Exception e) {
924 throw processException(e);
925 }
926 finally {
927 if (count == null) {
928 count = Long.valueOf(0);
929 }
930
931 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
932 count);
933
934 closeSession(session);
935 }
936 }
937
938 return count.intValue();
939 }
940
941
944 public void afterPropertiesSet() {
945 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
946 com.liferay.portal.util.PropsUtil.get(
947 "value.object.listener.com.liferay.portlet.shopping.model.ShoppingItemPrice")));
948
949 if (listenerClassNames.length > 0) {
950 try {
951 List<ModelListener<ShoppingItemPrice>> listenersList = new ArrayList<ModelListener<ShoppingItemPrice>>();
952
953 for (String listenerClassName : listenerClassNames) {
954 listenersList.add((ModelListener<ShoppingItemPrice>)InstanceFactory.newInstance(
955 listenerClassName));
956 }
957
958 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
959 }
960 catch (Exception e) {
961 _log.error(e);
962 }
963 }
964 }
965
966 public void destroy() {
967 EntityCacheUtil.removeCache(ShoppingItemPriceImpl.class.getName());
968 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
969 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
970 }
971
972 @BeanReference(type = ShoppingCartPersistence.class)
973 protected ShoppingCartPersistence shoppingCartPersistence;
974 @BeanReference(type = ShoppingCategoryPersistence.class)
975 protected ShoppingCategoryPersistence shoppingCategoryPersistence;
976 @BeanReference(type = ShoppingCouponPersistence.class)
977 protected ShoppingCouponPersistence shoppingCouponPersistence;
978 @BeanReference(type = ShoppingItemPersistence.class)
979 protected ShoppingItemPersistence shoppingItemPersistence;
980 @BeanReference(type = ShoppingItemFieldPersistence.class)
981 protected ShoppingItemFieldPersistence shoppingItemFieldPersistence;
982 @BeanReference(type = ShoppingItemPricePersistence.class)
983 protected ShoppingItemPricePersistence shoppingItemPricePersistence;
984 @BeanReference(type = ShoppingOrderPersistence.class)
985 protected ShoppingOrderPersistence shoppingOrderPersistence;
986 @BeanReference(type = ShoppingOrderItemPersistence.class)
987 protected ShoppingOrderItemPersistence shoppingOrderItemPersistence;
988 @BeanReference(type = ResourcePersistence.class)
989 protected ResourcePersistence resourcePersistence;
990 @BeanReference(type = UserPersistence.class)
991 protected UserPersistence userPersistence;
992 private static final String _SQL_SELECT_SHOPPINGITEMPRICE = "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice";
993 private static final String _SQL_SELECT_SHOPPINGITEMPRICE_WHERE = "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice WHERE ";
994 private static final String _SQL_COUNT_SHOPPINGITEMPRICE = "SELECT COUNT(shoppingItemPrice) FROM ShoppingItemPrice shoppingItemPrice";
995 private static final String _SQL_COUNT_SHOPPINGITEMPRICE_WHERE = "SELECT COUNT(shoppingItemPrice) FROM ShoppingItemPrice shoppingItemPrice WHERE ";
996 private static final String _FINDER_COLUMN_ITEMID_ITEMID_2 = "shoppingItemPrice.itemId = ?";
997 private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingItemPrice.";
998 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingItemPrice exists with the primary key ";
999 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingItemPrice exists with the key {";
1000 private static Log _log = LogFactoryUtil.getLog(ShoppingItemPricePersistenceImpl.class);
1001 }