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 if (shoppingItemPrice.isCachedModel() ||
225 BatchSessionUtil.isEnabled()) {
226 Object staleObject = session.get(ShoppingItemPriceImpl.class,
227 shoppingItemPrice.getPrimaryKeyObj());
228
229 if (staleObject != null) {
230 session.evict(staleObject);
231 }
232 }
233
234 session.delete(shoppingItemPrice);
235
236 session.flush();
237 }
238 catch (Exception e) {
239 throw processException(e);
240 }
241 finally {
242 closeSession(session);
243 }
244
245 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
246
247 EntityCacheUtil.removeResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
248 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey());
249
250 return shoppingItemPrice;
251 }
252
253 public ShoppingItemPrice updateImpl(
254 com.liferay.portlet.shopping.model.ShoppingItemPrice shoppingItemPrice,
255 boolean merge) throws SystemException {
256 shoppingItemPrice = toUnwrappedModel(shoppingItemPrice);
257
258 Session session = null;
259
260 try {
261 session = openSession();
262
263 BatchSessionUtil.update(session, shoppingItemPrice, merge);
264
265 shoppingItemPrice.setNew(false);
266 }
267 catch (Exception e) {
268 throw processException(e);
269 }
270 finally {
271 closeSession(session);
272 }
273
274 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
275
276 EntityCacheUtil.putResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
277 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey(),
278 shoppingItemPrice);
279
280 return shoppingItemPrice;
281 }
282
283 protected ShoppingItemPrice toUnwrappedModel(
284 ShoppingItemPrice shoppingItemPrice) {
285 if (shoppingItemPrice instanceof ShoppingItemPriceImpl) {
286 return shoppingItemPrice;
287 }
288
289 ShoppingItemPriceImpl shoppingItemPriceImpl = new ShoppingItemPriceImpl();
290
291 shoppingItemPriceImpl.setNew(shoppingItemPrice.isNew());
292 shoppingItemPriceImpl.setPrimaryKey(shoppingItemPrice.getPrimaryKey());
293
294 shoppingItemPriceImpl.setItemPriceId(shoppingItemPrice.getItemPriceId());
295 shoppingItemPriceImpl.setItemId(shoppingItemPrice.getItemId());
296 shoppingItemPriceImpl.setMinQuantity(shoppingItemPrice.getMinQuantity());
297 shoppingItemPriceImpl.setMaxQuantity(shoppingItemPrice.getMaxQuantity());
298 shoppingItemPriceImpl.setPrice(shoppingItemPrice.getPrice());
299 shoppingItemPriceImpl.setDiscount(shoppingItemPrice.getDiscount());
300 shoppingItemPriceImpl.setTaxable(shoppingItemPrice.isTaxable());
301 shoppingItemPriceImpl.setShipping(shoppingItemPrice.getShipping());
302 shoppingItemPriceImpl.setUseShippingFormula(shoppingItemPrice.isUseShippingFormula());
303 shoppingItemPriceImpl.setStatus(shoppingItemPrice.getStatus());
304
305 return shoppingItemPriceImpl;
306 }
307
308
316 public ShoppingItemPrice findByPrimaryKey(Serializable primaryKey)
317 throws NoSuchModelException, SystemException {
318 return findByPrimaryKey(((Long)primaryKey).longValue());
319 }
320
321
329 public ShoppingItemPrice findByPrimaryKey(long itemPriceId)
330 throws NoSuchItemPriceException, SystemException {
331 ShoppingItemPrice shoppingItemPrice = fetchByPrimaryKey(itemPriceId);
332
333 if (shoppingItemPrice == null) {
334 if (_log.isWarnEnabled()) {
335 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + itemPriceId);
336 }
337
338 throw new NoSuchItemPriceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
339 itemPriceId);
340 }
341
342 return shoppingItemPrice;
343 }
344
345
352 public ShoppingItemPrice fetchByPrimaryKey(Serializable primaryKey)
353 throws SystemException {
354 return fetchByPrimaryKey(((Long)primaryKey).longValue());
355 }
356
357
364 public ShoppingItemPrice fetchByPrimaryKey(long itemPriceId)
365 throws SystemException {
366 ShoppingItemPrice shoppingItemPrice = (ShoppingItemPrice)EntityCacheUtil.getResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
367 ShoppingItemPriceImpl.class, itemPriceId, this);
368
369 if (shoppingItemPrice == null) {
370 Session session = null;
371
372 try {
373 session = openSession();
374
375 shoppingItemPrice = (ShoppingItemPrice)session.get(ShoppingItemPriceImpl.class,
376 new Long(itemPriceId));
377 }
378 catch (Exception e) {
379 throw processException(e);
380 }
381 finally {
382 if (shoppingItemPrice != null) {
383 cacheResult(shoppingItemPrice);
384 }
385
386 closeSession(session);
387 }
388 }
389
390 return shoppingItemPrice;
391 }
392
393
400 public List<ShoppingItemPrice> findByItemId(long itemId)
401 throws SystemException {
402 return findByItemId(itemId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
403 }
404
405
418 public List<ShoppingItemPrice> findByItemId(long itemId, int start, int end)
419 throws SystemException {
420 return findByItemId(itemId, start, end, null);
421 }
422
423
437 public List<ShoppingItemPrice> findByItemId(long itemId, int start,
438 int end, OrderByComparator orderByComparator) throws SystemException {
439 Object[] finderArgs = new Object[] {
440 itemId,
441
442 String.valueOf(start), String.valueOf(end),
443 String.valueOf(orderByComparator)
444 };
445
446 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ITEMID,
447 finderArgs, this);
448
449 if (list == null) {
450 Session session = null;
451
452 try {
453 session = openSession();
454
455 StringBundler query = null;
456
457 if (orderByComparator != null) {
458 query = new StringBundler(3 +
459 (orderByComparator.getOrderByFields().length * 3));
460 }
461 else {
462 query = new StringBundler(3);
463 }
464
465 query.append(_SQL_SELECT_SHOPPINGITEMPRICE_WHERE);
466
467 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
468
469 if (orderByComparator != null) {
470 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
471 orderByComparator);
472 }
473
474 else {
475 query.append(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
476 }
477
478 String sql = query.toString();
479
480 Query q = session.createQuery(sql);
481
482 QueryPos qPos = QueryPos.getInstance(q);
483
484 qPos.add(itemId);
485
486 list = (List<ShoppingItemPrice>)QueryUtil.list(q, getDialect(),
487 start, end);
488 }
489 catch (Exception e) {
490 throw processException(e);
491 }
492 finally {
493 if (list == null) {
494 list = new ArrayList<ShoppingItemPrice>();
495 }
496
497 cacheResult(list);
498
499 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ITEMID,
500 finderArgs, list);
501
502 closeSession(session);
503 }
504 }
505
506 return list;
507 }
508
509
522 public ShoppingItemPrice findByItemId_First(long itemId,
523 OrderByComparator orderByComparator)
524 throws NoSuchItemPriceException, SystemException {
525 List<ShoppingItemPrice> list = findByItemId(itemId, 0, 1,
526 orderByComparator);
527
528 if (list.isEmpty()) {
529 StringBundler msg = new StringBundler(4);
530
531 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
532
533 msg.append("itemId=");
534 msg.append(itemId);
535
536 msg.append(StringPool.CLOSE_CURLY_BRACE);
537
538 throw new NoSuchItemPriceException(msg.toString());
539 }
540 else {
541 return list.get(0);
542 }
543 }
544
545
558 public ShoppingItemPrice findByItemId_Last(long itemId,
559 OrderByComparator orderByComparator)
560 throws NoSuchItemPriceException, SystemException {
561 int count = countByItemId(itemId);
562
563 List<ShoppingItemPrice> list = findByItemId(itemId, count - 1, count,
564 orderByComparator);
565
566 if (list.isEmpty()) {
567 StringBundler msg = new StringBundler(4);
568
569 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
570
571 msg.append("itemId=");
572 msg.append(itemId);
573
574 msg.append(StringPool.CLOSE_CURLY_BRACE);
575
576 throw new NoSuchItemPriceException(msg.toString());
577 }
578 else {
579 return list.get(0);
580 }
581 }
582
583
597 public ShoppingItemPrice[] findByItemId_PrevAndNext(long itemPriceId,
598 long itemId, OrderByComparator orderByComparator)
599 throws NoSuchItemPriceException, SystemException {
600 ShoppingItemPrice shoppingItemPrice = findByPrimaryKey(itemPriceId);
601
602 Session session = null;
603
604 try {
605 session = openSession();
606
607 ShoppingItemPrice[] array = new ShoppingItemPriceImpl[3];
608
609 array[0] = getByItemId_PrevAndNext(session, shoppingItemPrice,
610 itemId, orderByComparator, true);
611
612 array[1] = shoppingItemPrice;
613
614 array[2] = getByItemId_PrevAndNext(session, shoppingItemPrice,
615 itemId, orderByComparator, false);
616
617 return array;
618 }
619 catch (Exception e) {
620 throw processException(e);
621 }
622 finally {
623 closeSession(session);
624 }
625 }
626
627 protected ShoppingItemPrice getByItemId_PrevAndNext(Session session,
628 ShoppingItemPrice shoppingItemPrice, long itemId,
629 OrderByComparator orderByComparator, boolean previous) {
630 StringBundler query = null;
631
632 if (orderByComparator != null) {
633 query = new StringBundler(6 +
634 (orderByComparator.getOrderByFields().length * 6));
635 }
636 else {
637 query = new StringBundler(3);
638 }
639
640 query.append(_SQL_SELECT_SHOPPINGITEMPRICE_WHERE);
641
642 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
643
644 if (orderByComparator != null) {
645 String[] orderByFields = orderByComparator.getOrderByFields();
646
647 if (orderByFields.length > 0) {
648 query.append(WHERE_AND);
649 }
650
651 for (int i = 0; i < orderByFields.length; i++) {
652 query.append(_ORDER_BY_ENTITY_ALIAS);
653 query.append(orderByFields[i]);
654
655 if ((i + 1) < orderByFields.length) {
656 if (orderByComparator.isAscending() ^ previous) {
657 query.append(WHERE_GREATER_THAN_HAS_NEXT);
658 }
659 else {
660 query.append(WHERE_LESSER_THAN_HAS_NEXT);
661 }
662 }
663 else {
664 if (orderByComparator.isAscending() ^ previous) {
665 query.append(WHERE_GREATER_THAN);
666 }
667 else {
668 query.append(WHERE_LESSER_THAN);
669 }
670 }
671 }
672
673 query.append(ORDER_BY_CLAUSE);
674
675 for (int i = 0; i < orderByFields.length; i++) {
676 query.append(_ORDER_BY_ENTITY_ALIAS);
677 query.append(orderByFields[i]);
678
679 if ((i + 1) < orderByFields.length) {
680 if (orderByComparator.isAscending() ^ previous) {
681 query.append(ORDER_BY_ASC_HAS_NEXT);
682 }
683 else {
684 query.append(ORDER_BY_DESC_HAS_NEXT);
685 }
686 }
687 else {
688 if (orderByComparator.isAscending() ^ previous) {
689 query.append(ORDER_BY_ASC);
690 }
691 else {
692 query.append(ORDER_BY_DESC);
693 }
694 }
695 }
696 }
697
698 else {
699 query.append(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
700 }
701
702 String sql = query.toString();
703
704 Query q = session.createQuery(sql);
705
706 q.setFirstResult(0);
707 q.setMaxResults(2);
708
709 QueryPos qPos = QueryPos.getInstance(q);
710
711 qPos.add(itemId);
712
713 if (orderByComparator != null) {
714 Object[] values = orderByComparator.getOrderByValues(shoppingItemPrice);
715
716 for (Object value : values) {
717 qPos.add(value);
718 }
719 }
720
721 List<ShoppingItemPrice> list = q.list();
722
723 if (list.size() == 2) {
724 return list.get(1);
725 }
726 else {
727 return null;
728 }
729 }
730
731
737 public List<ShoppingItemPrice> findAll() throws SystemException {
738 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
739 }
740
741
753 public List<ShoppingItemPrice> findAll(int start, int end)
754 throws SystemException {
755 return findAll(start, end, null);
756 }
757
758
771 public List<ShoppingItemPrice> findAll(int start, int end,
772 OrderByComparator orderByComparator) throws SystemException {
773 Object[] finderArgs = new Object[] {
774 String.valueOf(start), String.valueOf(end),
775 String.valueOf(orderByComparator)
776 };
777
778 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
779 finderArgs, this);
780
781 if (list == null) {
782 Session session = null;
783
784 try {
785 session = openSession();
786
787 StringBundler query = null;
788 String sql = null;
789
790 if (orderByComparator != null) {
791 query = new StringBundler(2 +
792 (orderByComparator.getOrderByFields().length * 3));
793
794 query.append(_SQL_SELECT_SHOPPINGITEMPRICE);
795
796 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
797 orderByComparator);
798
799 sql = query.toString();
800 }
801 else {
802 sql = _SQL_SELECT_SHOPPINGITEMPRICE.concat(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
803 }
804
805 Query q = session.createQuery(sql);
806
807 if (orderByComparator == null) {
808 list = (List<ShoppingItemPrice>)QueryUtil.list(q,
809 getDialect(), start, end, false);
810
811 Collections.sort(list);
812 }
813 else {
814 list = (List<ShoppingItemPrice>)QueryUtil.list(q,
815 getDialect(), start, end);
816 }
817 }
818 catch (Exception e) {
819 throw processException(e);
820 }
821 finally {
822 if (list == null) {
823 list = new ArrayList<ShoppingItemPrice>();
824 }
825
826 cacheResult(list);
827
828 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
829
830 closeSession(session);
831 }
832 }
833
834 return list;
835 }
836
837
843 public void removeByItemId(long itemId) throws SystemException {
844 for (ShoppingItemPrice shoppingItemPrice : findByItemId(itemId)) {
845 remove(shoppingItemPrice);
846 }
847 }
848
849
854 public void removeAll() throws SystemException {
855 for (ShoppingItemPrice shoppingItemPrice : findAll()) {
856 remove(shoppingItemPrice);
857 }
858 }
859
860
867 public int countByItemId(long itemId) throws SystemException {
868 Object[] finderArgs = new Object[] { itemId };
869
870 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ITEMID,
871 finderArgs, this);
872
873 if (count == null) {
874 Session session = null;
875
876 try {
877 session = openSession();
878
879 StringBundler query = new StringBundler(2);
880
881 query.append(_SQL_COUNT_SHOPPINGITEMPRICE_WHERE);
882
883 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
884
885 String sql = query.toString();
886
887 Query q = session.createQuery(sql);
888
889 QueryPos qPos = QueryPos.getInstance(q);
890
891 qPos.add(itemId);
892
893 count = (Long)q.uniqueResult();
894 }
895 catch (Exception e) {
896 throw processException(e);
897 }
898 finally {
899 if (count == null) {
900 count = Long.valueOf(0);
901 }
902
903 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ITEMID,
904 finderArgs, count);
905
906 closeSession(session);
907 }
908 }
909
910 return count.intValue();
911 }
912
913
919 public int countAll() throws SystemException {
920 Object[] finderArgs = new Object[0];
921
922 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
923 finderArgs, this);
924
925 if (count == null) {
926 Session session = null;
927
928 try {
929 session = openSession();
930
931 Query q = session.createQuery(_SQL_COUNT_SHOPPINGITEMPRICE);
932
933 count = (Long)q.uniqueResult();
934 }
935 catch (Exception e) {
936 throw processException(e);
937 }
938 finally {
939 if (count == null) {
940 count = Long.valueOf(0);
941 }
942
943 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
944 count);
945
946 closeSession(session);
947 }
948 }
949
950 return count.intValue();
951 }
952
953
956 public void afterPropertiesSet() {
957 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
958 com.liferay.portal.util.PropsUtil.get(
959 "value.object.listener.com.liferay.portlet.shopping.model.ShoppingItemPrice")));
960
961 if (listenerClassNames.length > 0) {
962 try {
963 List<ModelListener<ShoppingItemPrice>> listenersList = new ArrayList<ModelListener<ShoppingItemPrice>>();
964
965 for (String listenerClassName : listenerClassNames) {
966 listenersList.add((ModelListener<ShoppingItemPrice>)InstanceFactory.newInstance(
967 listenerClassName));
968 }
969
970 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
971 }
972 catch (Exception e) {
973 _log.error(e);
974 }
975 }
976 }
977
978 @BeanReference(type = ShoppingCartPersistence.class)
979 protected ShoppingCartPersistence shoppingCartPersistence;
980 @BeanReference(type = ShoppingCategoryPersistence.class)
981 protected ShoppingCategoryPersistence shoppingCategoryPersistence;
982 @BeanReference(type = ShoppingCouponPersistence.class)
983 protected ShoppingCouponPersistence shoppingCouponPersistence;
984 @BeanReference(type = ShoppingItemPersistence.class)
985 protected ShoppingItemPersistence shoppingItemPersistence;
986 @BeanReference(type = ShoppingItemFieldPersistence.class)
987 protected ShoppingItemFieldPersistence shoppingItemFieldPersistence;
988 @BeanReference(type = ShoppingItemPricePersistence.class)
989 protected ShoppingItemPricePersistence shoppingItemPricePersistence;
990 @BeanReference(type = ShoppingOrderPersistence.class)
991 protected ShoppingOrderPersistence shoppingOrderPersistence;
992 @BeanReference(type = ShoppingOrderItemPersistence.class)
993 protected ShoppingOrderItemPersistence shoppingOrderItemPersistence;
994 @BeanReference(type = ResourcePersistence.class)
995 protected ResourcePersistence resourcePersistence;
996 @BeanReference(type = UserPersistence.class)
997 protected UserPersistence userPersistence;
998 private static final String _SQL_SELECT_SHOPPINGITEMPRICE = "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice";
999 private static final String _SQL_SELECT_SHOPPINGITEMPRICE_WHERE = "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice WHERE ";
1000 private static final String _SQL_COUNT_SHOPPINGITEMPRICE = "SELECT COUNT(shoppingItemPrice) FROM ShoppingItemPrice shoppingItemPrice";
1001 private static final String _SQL_COUNT_SHOPPINGITEMPRICE_WHERE = "SELECT COUNT(shoppingItemPrice) FROM ShoppingItemPrice shoppingItemPrice WHERE ";
1002 private static final String _FINDER_COLUMN_ITEMID_ITEMID_2 = "shoppingItemPrice.itemId = ?";
1003 private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingItemPrice.";
1004 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingItemPrice exists with the primary key ";
1005 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingItemPrice exists with the key {";
1006 private static Log _log = LogFactoryUtil.getLog(ShoppingItemPricePersistenceImpl.class);
1007 }