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.jdbc.MappingSqlQuery;
021 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
022 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
023 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
024 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
025 import com.liferay.portal.kernel.dao.orm.FinderPath;
026 import com.liferay.portal.kernel.dao.orm.Query;
027 import com.liferay.portal.kernel.dao.orm.QueryPos;
028 import com.liferay.portal.kernel.dao.orm.QueryUtil;
029 import com.liferay.portal.kernel.dao.orm.SQLQuery;
030 import com.liferay.portal.kernel.dao.orm.Session;
031 import com.liferay.portal.kernel.exception.SystemException;
032 import com.liferay.portal.kernel.log.Log;
033 import com.liferay.portal.kernel.log.LogFactoryUtil;
034 import com.liferay.portal.kernel.util.GetterUtil;
035 import com.liferay.portal.kernel.util.InstanceFactory;
036 import com.liferay.portal.kernel.util.OrderByComparator;
037 import com.liferay.portal.kernel.util.StringBundler;
038 import com.liferay.portal.kernel.util.StringPool;
039 import com.liferay.portal.kernel.util.StringUtil;
040 import com.liferay.portal.kernel.util.Validator;
041 import com.liferay.portal.model.ModelListener;
042 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
043 import com.liferay.portal.service.persistence.BatchSessionUtil;
044 import com.liferay.portal.service.persistence.ImagePersistence;
045 import com.liferay.portal.service.persistence.ResourcePersistence;
046 import com.liferay.portal.service.persistence.UserPersistence;
047 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
048
049 import com.liferay.portlet.shopping.NoSuchItemException;
050 import com.liferay.portlet.shopping.model.ShoppingItem;
051 import com.liferay.portlet.shopping.model.impl.ShoppingItemImpl;
052 import com.liferay.portlet.shopping.model.impl.ShoppingItemModelImpl;
053
054 import java.io.Serializable;
055
056 import java.util.ArrayList;
057 import java.util.Collections;
058 import java.util.List;
059
060
076 public class ShoppingItemPersistenceImpl extends BasePersistenceImpl<ShoppingItem>
077 implements ShoppingItemPersistence {
078 public static final String FINDER_CLASS_NAME_ENTITY = ShoppingItemImpl.class.getName();
079 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
080 ".List";
081 public static final FinderPath FINDER_PATH_FETCH_BY_SMALLIMAGEID = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
082 ShoppingItemModelImpl.FINDER_CACHE_ENABLED,
083 FINDER_CLASS_NAME_ENTITY, "fetchBySmallImageId",
084 new String[] { Long.class.getName() });
085 public static final FinderPath FINDER_PATH_COUNT_BY_SMALLIMAGEID = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
086 ShoppingItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
087 "countBySmallImageId", new String[] { Long.class.getName() });
088 public static final FinderPath FINDER_PATH_FETCH_BY_MEDIUMIMAGEID = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
089 ShoppingItemModelImpl.FINDER_CACHE_ENABLED,
090 FINDER_CLASS_NAME_ENTITY, "fetchByMediumImageId",
091 new String[] { Long.class.getName() });
092 public static final FinderPath FINDER_PATH_COUNT_BY_MEDIUMIMAGEID = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
093 ShoppingItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
094 "countByMediumImageId", new String[] { Long.class.getName() });
095 public static final FinderPath FINDER_PATH_FETCH_BY_LARGEIMAGEID = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
096 ShoppingItemModelImpl.FINDER_CACHE_ENABLED,
097 FINDER_CLASS_NAME_ENTITY, "fetchByLargeImageId",
098 new String[] { Long.class.getName() });
099 public static final FinderPath FINDER_PATH_COUNT_BY_LARGEIMAGEID = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
100 ShoppingItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
101 "countByLargeImageId", new String[] { Long.class.getName() });
102 public static final FinderPath FINDER_PATH_FIND_BY_G_C = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
103 ShoppingItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
104 "findByG_C",
105 new String[] {
106 Long.class.getName(), Long.class.getName(),
107
108 "java.lang.Integer", "java.lang.Integer",
109 "com.liferay.portal.kernel.util.OrderByComparator"
110 });
111 public static final FinderPath FINDER_PATH_COUNT_BY_G_C = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
112 ShoppingItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
113 "countByG_C",
114 new String[] { Long.class.getName(), Long.class.getName() });
115 public static final FinderPath FINDER_PATH_FETCH_BY_C_S = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
116 ShoppingItemModelImpl.FINDER_CACHE_ENABLED,
117 FINDER_CLASS_NAME_ENTITY, "fetchByC_S",
118 new String[] { Long.class.getName(), String.class.getName() });
119 public static final FinderPath FINDER_PATH_COUNT_BY_C_S = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
120 ShoppingItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
121 "countByC_S",
122 new String[] { Long.class.getName(), String.class.getName() });
123 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
124 ShoppingItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
125 "findAll", new String[0]);
126 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
127 ShoppingItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
128 "countAll", new String[0]);
129
130
135 public void cacheResult(ShoppingItem shoppingItem) {
136 EntityCacheUtil.putResult(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
137 ShoppingItemImpl.class, shoppingItem.getPrimaryKey(), shoppingItem);
138
139 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
140 new Object[] { new Long(shoppingItem.getSmallImageId()) },
141 shoppingItem);
142
143 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MEDIUMIMAGEID,
144 new Object[] { new Long(shoppingItem.getMediumImageId()) },
145 shoppingItem);
146
147 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
148 new Object[] { new Long(shoppingItem.getLargeImageId()) },
149 shoppingItem);
150
151 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_S,
152 new Object[] {
153 new Long(shoppingItem.getCompanyId()),
154
155 shoppingItem.getSku()
156 }, shoppingItem);
157 }
158
159
164 public void cacheResult(List<ShoppingItem> shoppingItems) {
165 for (ShoppingItem shoppingItem : shoppingItems) {
166 if (EntityCacheUtil.getResult(
167 ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
168 ShoppingItemImpl.class, shoppingItem.getPrimaryKey(),
169 this) == null) {
170 cacheResult(shoppingItem);
171 }
172 }
173 }
174
175
182 public void clearCache() {
183 CacheRegistryUtil.clear(ShoppingItemImpl.class.getName());
184 EntityCacheUtil.clearCache(ShoppingItemImpl.class.getName());
185 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
186 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
187 }
188
189
196 public void clearCache(ShoppingItem shoppingItem) {
197 EntityCacheUtil.removeResult(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
198 ShoppingItemImpl.class, shoppingItem.getPrimaryKey());
199
200 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
201 new Object[] { new Long(shoppingItem.getSmallImageId()) });
202
203 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MEDIUMIMAGEID,
204 new Object[] { new Long(shoppingItem.getMediumImageId()) });
205
206 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
207 new Object[] { new Long(shoppingItem.getLargeImageId()) });
208
209 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_S,
210 new Object[] {
211 new Long(shoppingItem.getCompanyId()),
212
213 shoppingItem.getSku()
214 });
215 }
216
217
223 public ShoppingItem create(long itemId) {
224 ShoppingItem shoppingItem = new ShoppingItemImpl();
225
226 shoppingItem.setNew(true);
227 shoppingItem.setPrimaryKey(itemId);
228
229 return shoppingItem;
230 }
231
232
240 public ShoppingItem remove(Serializable primaryKey)
241 throws NoSuchModelException, SystemException {
242 return remove(((Long)primaryKey).longValue());
243 }
244
245
253 public ShoppingItem remove(long itemId)
254 throws NoSuchItemException, SystemException {
255 Session session = null;
256
257 try {
258 session = openSession();
259
260 ShoppingItem shoppingItem = (ShoppingItem)session.get(ShoppingItemImpl.class,
261 new Long(itemId));
262
263 if (shoppingItem == null) {
264 if (_log.isWarnEnabled()) {
265 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + itemId);
266 }
267
268 throw new NoSuchItemException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
269 itemId);
270 }
271
272 return remove(shoppingItem);
273 }
274 catch (NoSuchItemException nsee) {
275 throw nsee;
276 }
277 catch (Exception e) {
278 throw processException(e);
279 }
280 finally {
281 closeSession(session);
282 }
283 }
284
285 protected ShoppingItem removeImpl(ShoppingItem shoppingItem)
286 throws SystemException {
287 shoppingItem = toUnwrappedModel(shoppingItem);
288
289 Session session = null;
290
291 try {
292 session = openSession();
293
294 BatchSessionUtil.delete(session, shoppingItem);
295 }
296 catch (Exception e) {
297 throw processException(e);
298 }
299 finally {
300 closeSession(session);
301 }
302
303 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
304
305 ShoppingItemModelImpl shoppingItemModelImpl = (ShoppingItemModelImpl)shoppingItem;
306
307 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
308 new Object[] { new Long(shoppingItemModelImpl.getSmallImageId()) });
309
310 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MEDIUMIMAGEID,
311 new Object[] { new Long(shoppingItemModelImpl.getMediumImageId()) });
312
313 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
314 new Object[] { new Long(shoppingItemModelImpl.getLargeImageId()) });
315
316 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_S,
317 new Object[] {
318 new Long(shoppingItemModelImpl.getCompanyId()),
319
320 shoppingItemModelImpl.getSku()
321 });
322
323 EntityCacheUtil.removeResult(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
324 ShoppingItemImpl.class, shoppingItem.getPrimaryKey());
325
326 return shoppingItem;
327 }
328
329 public ShoppingItem updateImpl(
330 com.liferay.portlet.shopping.model.ShoppingItem shoppingItem,
331 boolean merge) throws SystemException {
332 shoppingItem = toUnwrappedModel(shoppingItem);
333
334 boolean isNew = shoppingItem.isNew();
335
336 ShoppingItemModelImpl shoppingItemModelImpl = (ShoppingItemModelImpl)shoppingItem;
337
338 Session session = null;
339
340 try {
341 session = openSession();
342
343 BatchSessionUtil.update(session, shoppingItem, merge);
344
345 shoppingItem.setNew(false);
346 }
347 catch (Exception e) {
348 throw processException(e);
349 }
350 finally {
351 closeSession(session);
352 }
353
354 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
355
356 EntityCacheUtil.putResult(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
357 ShoppingItemImpl.class, shoppingItem.getPrimaryKey(), shoppingItem);
358
359 if (!isNew &&
360 (shoppingItem.getSmallImageId() != shoppingItemModelImpl.getOriginalSmallImageId())) {
361 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
362 new Object[] {
363 new Long(shoppingItemModelImpl.getOriginalSmallImageId())
364 });
365 }
366
367 if (isNew ||
368 (shoppingItem.getSmallImageId() != shoppingItemModelImpl.getOriginalSmallImageId())) {
369 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
370 new Object[] { new Long(shoppingItem.getSmallImageId()) },
371 shoppingItem);
372 }
373
374 if (!isNew &&
375 (shoppingItem.getMediumImageId() != shoppingItemModelImpl.getOriginalMediumImageId())) {
376 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MEDIUMIMAGEID,
377 new Object[] {
378 new Long(shoppingItemModelImpl.getOriginalMediumImageId())
379 });
380 }
381
382 if (isNew ||
383 (shoppingItem.getMediumImageId() != shoppingItemModelImpl.getOriginalMediumImageId())) {
384 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MEDIUMIMAGEID,
385 new Object[] { new Long(shoppingItem.getMediumImageId()) },
386 shoppingItem);
387 }
388
389 if (!isNew &&
390 (shoppingItem.getLargeImageId() != shoppingItemModelImpl.getOriginalLargeImageId())) {
391 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
392 new Object[] {
393 new Long(shoppingItemModelImpl.getOriginalLargeImageId())
394 });
395 }
396
397 if (isNew ||
398 (shoppingItem.getLargeImageId() != shoppingItemModelImpl.getOriginalLargeImageId())) {
399 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
400 new Object[] { new Long(shoppingItem.getLargeImageId()) },
401 shoppingItem);
402 }
403
404 if (!isNew &&
405 ((shoppingItem.getCompanyId() != shoppingItemModelImpl.getOriginalCompanyId()) ||
406 !Validator.equals(shoppingItem.getSku(),
407 shoppingItemModelImpl.getOriginalSku()))) {
408 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_S,
409 new Object[] {
410 new Long(shoppingItemModelImpl.getOriginalCompanyId()),
411
412 shoppingItemModelImpl.getOriginalSku()
413 });
414 }
415
416 if (isNew ||
417 ((shoppingItem.getCompanyId() != shoppingItemModelImpl.getOriginalCompanyId()) ||
418 !Validator.equals(shoppingItem.getSku(),
419 shoppingItemModelImpl.getOriginalSku()))) {
420 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_S,
421 new Object[] {
422 new Long(shoppingItem.getCompanyId()),
423
424 shoppingItem.getSku()
425 }, shoppingItem);
426 }
427
428 return shoppingItem;
429 }
430
431 protected ShoppingItem toUnwrappedModel(ShoppingItem shoppingItem) {
432 if (shoppingItem instanceof ShoppingItemImpl) {
433 return shoppingItem;
434 }
435
436 ShoppingItemImpl shoppingItemImpl = new ShoppingItemImpl();
437
438 shoppingItemImpl.setNew(shoppingItem.isNew());
439 shoppingItemImpl.setPrimaryKey(shoppingItem.getPrimaryKey());
440
441 shoppingItemImpl.setItemId(shoppingItem.getItemId());
442 shoppingItemImpl.setGroupId(shoppingItem.getGroupId());
443 shoppingItemImpl.setCompanyId(shoppingItem.getCompanyId());
444 shoppingItemImpl.setUserId(shoppingItem.getUserId());
445 shoppingItemImpl.setUserName(shoppingItem.getUserName());
446 shoppingItemImpl.setCreateDate(shoppingItem.getCreateDate());
447 shoppingItemImpl.setModifiedDate(shoppingItem.getModifiedDate());
448 shoppingItemImpl.setCategoryId(shoppingItem.getCategoryId());
449 shoppingItemImpl.setSku(shoppingItem.getSku());
450 shoppingItemImpl.setName(shoppingItem.getName());
451 shoppingItemImpl.setDescription(shoppingItem.getDescription());
452 shoppingItemImpl.setProperties(shoppingItem.getProperties());
453 shoppingItemImpl.setFields(shoppingItem.isFields());
454 shoppingItemImpl.setFieldsQuantities(shoppingItem.getFieldsQuantities());
455 shoppingItemImpl.setMinQuantity(shoppingItem.getMinQuantity());
456 shoppingItemImpl.setMaxQuantity(shoppingItem.getMaxQuantity());
457 shoppingItemImpl.setPrice(shoppingItem.getPrice());
458 shoppingItemImpl.setDiscount(shoppingItem.getDiscount());
459 shoppingItemImpl.setTaxable(shoppingItem.isTaxable());
460 shoppingItemImpl.setShipping(shoppingItem.getShipping());
461 shoppingItemImpl.setUseShippingFormula(shoppingItem.isUseShippingFormula());
462 shoppingItemImpl.setRequiresShipping(shoppingItem.isRequiresShipping());
463 shoppingItemImpl.setStockQuantity(shoppingItem.getStockQuantity());
464 shoppingItemImpl.setFeatured(shoppingItem.isFeatured());
465 shoppingItemImpl.setSale(shoppingItem.isSale());
466 shoppingItemImpl.setSmallImage(shoppingItem.isSmallImage());
467 shoppingItemImpl.setSmallImageId(shoppingItem.getSmallImageId());
468 shoppingItemImpl.setSmallImageURL(shoppingItem.getSmallImageURL());
469 shoppingItemImpl.setMediumImage(shoppingItem.isMediumImage());
470 shoppingItemImpl.setMediumImageId(shoppingItem.getMediumImageId());
471 shoppingItemImpl.setMediumImageURL(shoppingItem.getMediumImageURL());
472 shoppingItemImpl.setLargeImage(shoppingItem.isLargeImage());
473 shoppingItemImpl.setLargeImageId(shoppingItem.getLargeImageId());
474 shoppingItemImpl.setLargeImageURL(shoppingItem.getLargeImageURL());
475
476 return shoppingItemImpl;
477 }
478
479
487 public ShoppingItem findByPrimaryKey(Serializable primaryKey)
488 throws NoSuchModelException, SystemException {
489 return findByPrimaryKey(((Long)primaryKey).longValue());
490 }
491
492
500 public ShoppingItem findByPrimaryKey(long itemId)
501 throws NoSuchItemException, SystemException {
502 ShoppingItem shoppingItem = fetchByPrimaryKey(itemId);
503
504 if (shoppingItem == null) {
505 if (_log.isWarnEnabled()) {
506 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + itemId);
507 }
508
509 throw new NoSuchItemException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
510 itemId);
511 }
512
513 return shoppingItem;
514 }
515
516
523 public ShoppingItem fetchByPrimaryKey(Serializable primaryKey)
524 throws SystemException {
525 return fetchByPrimaryKey(((Long)primaryKey).longValue());
526 }
527
528
535 public ShoppingItem fetchByPrimaryKey(long itemId)
536 throws SystemException {
537 ShoppingItem shoppingItem = (ShoppingItem)EntityCacheUtil.getResult(ShoppingItemModelImpl.ENTITY_CACHE_ENABLED,
538 ShoppingItemImpl.class, itemId, this);
539
540 if (shoppingItem == null) {
541 Session session = null;
542
543 try {
544 session = openSession();
545
546 shoppingItem = (ShoppingItem)session.get(ShoppingItemImpl.class,
547 new Long(itemId));
548 }
549 catch (Exception e) {
550 throw processException(e);
551 }
552 finally {
553 if (shoppingItem != null) {
554 cacheResult(shoppingItem);
555 }
556
557 closeSession(session);
558 }
559 }
560
561 return shoppingItem;
562 }
563
564
572 public ShoppingItem findBySmallImageId(long smallImageId)
573 throws NoSuchItemException, SystemException {
574 ShoppingItem shoppingItem = fetchBySmallImageId(smallImageId);
575
576 if (shoppingItem == null) {
577 StringBundler msg = new StringBundler(4);
578
579 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
580
581 msg.append("smallImageId=");
582 msg.append(smallImageId);
583
584 msg.append(StringPool.CLOSE_CURLY_BRACE);
585
586 if (_log.isWarnEnabled()) {
587 _log.warn(msg.toString());
588 }
589
590 throw new NoSuchItemException(msg.toString());
591 }
592
593 return shoppingItem;
594 }
595
596
603 public ShoppingItem fetchBySmallImageId(long smallImageId)
604 throws SystemException {
605 return fetchBySmallImageId(smallImageId, true);
606 }
607
608
615 public ShoppingItem fetchBySmallImageId(long smallImageId,
616 boolean retrieveFromCache) throws SystemException {
617 Object[] finderArgs = new Object[] { smallImageId };
618
619 Object result = null;
620
621 if (retrieveFromCache) {
622 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
623 finderArgs, this);
624 }
625
626 if (result == null) {
627 StringBundler query = new StringBundler(3);
628
629 query.append(_SQL_SELECT_SHOPPINGITEM_WHERE);
630
631 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
632
633 query.append(ShoppingItemModelImpl.ORDER_BY_JPQL);
634
635 String sql = query.toString();
636
637 Session session = null;
638
639 try {
640 session = openSession();
641
642 Query q = session.createQuery(sql);
643
644 QueryPos qPos = QueryPos.getInstance(q);
645
646 qPos.add(smallImageId);
647
648 List<ShoppingItem> list = q.list();
649
650 result = list;
651
652 ShoppingItem shoppingItem = null;
653
654 if (list.isEmpty()) {
655 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
656 finderArgs, list);
657 }
658 else {
659 shoppingItem = list.get(0);
660
661 cacheResult(shoppingItem);
662
663 if ((shoppingItem.getSmallImageId() != smallImageId)) {
664 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
665 finderArgs, shoppingItem);
666 }
667 }
668
669 return shoppingItem;
670 }
671 catch (Exception e) {
672 throw processException(e);
673 }
674 finally {
675 if (result == null) {
676 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
677 finderArgs);
678 }
679
680 closeSession(session);
681 }
682 }
683 else {
684 if (result instanceof List<?>) {
685 return null;
686 }
687 else {
688 return (ShoppingItem)result;
689 }
690 }
691 }
692
693
701 public ShoppingItem findByMediumImageId(long mediumImageId)
702 throws NoSuchItemException, SystemException {
703 ShoppingItem shoppingItem = fetchByMediumImageId(mediumImageId);
704
705 if (shoppingItem == null) {
706 StringBundler msg = new StringBundler(4);
707
708 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
709
710 msg.append("mediumImageId=");
711 msg.append(mediumImageId);
712
713 msg.append(StringPool.CLOSE_CURLY_BRACE);
714
715 if (_log.isWarnEnabled()) {
716 _log.warn(msg.toString());
717 }
718
719 throw new NoSuchItemException(msg.toString());
720 }
721
722 return shoppingItem;
723 }
724
725
732 public ShoppingItem fetchByMediumImageId(long mediumImageId)
733 throws SystemException {
734 return fetchByMediumImageId(mediumImageId, true);
735 }
736
737
744 public ShoppingItem fetchByMediumImageId(long mediumImageId,
745 boolean retrieveFromCache) throws SystemException {
746 Object[] finderArgs = new Object[] { mediumImageId };
747
748 Object result = null;
749
750 if (retrieveFromCache) {
751 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_MEDIUMIMAGEID,
752 finderArgs, this);
753 }
754
755 if (result == null) {
756 StringBundler query = new StringBundler(3);
757
758 query.append(_SQL_SELECT_SHOPPINGITEM_WHERE);
759
760 query.append(_FINDER_COLUMN_MEDIUMIMAGEID_MEDIUMIMAGEID_2);
761
762 query.append(ShoppingItemModelImpl.ORDER_BY_JPQL);
763
764 String sql = query.toString();
765
766 Session session = null;
767
768 try {
769 session = openSession();
770
771 Query q = session.createQuery(sql);
772
773 QueryPos qPos = QueryPos.getInstance(q);
774
775 qPos.add(mediumImageId);
776
777 List<ShoppingItem> list = q.list();
778
779 result = list;
780
781 ShoppingItem shoppingItem = null;
782
783 if (list.isEmpty()) {
784 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MEDIUMIMAGEID,
785 finderArgs, list);
786 }
787 else {
788 shoppingItem = list.get(0);
789
790 cacheResult(shoppingItem);
791
792 if ((shoppingItem.getMediumImageId() != mediumImageId)) {
793 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MEDIUMIMAGEID,
794 finderArgs, shoppingItem);
795 }
796 }
797
798 return shoppingItem;
799 }
800 catch (Exception e) {
801 throw processException(e);
802 }
803 finally {
804 if (result == null) {
805 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MEDIUMIMAGEID,
806 finderArgs);
807 }
808
809 closeSession(session);
810 }
811 }
812 else {
813 if (result instanceof List<?>) {
814 return null;
815 }
816 else {
817 return (ShoppingItem)result;
818 }
819 }
820 }
821
822
830 public ShoppingItem findByLargeImageId(long largeImageId)
831 throws NoSuchItemException, SystemException {
832 ShoppingItem shoppingItem = fetchByLargeImageId(largeImageId);
833
834 if (shoppingItem == null) {
835 StringBundler msg = new StringBundler(4);
836
837 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
838
839 msg.append("largeImageId=");
840 msg.append(largeImageId);
841
842 msg.append(StringPool.CLOSE_CURLY_BRACE);
843
844 if (_log.isWarnEnabled()) {
845 _log.warn(msg.toString());
846 }
847
848 throw new NoSuchItemException(msg.toString());
849 }
850
851 return shoppingItem;
852 }
853
854
861 public ShoppingItem fetchByLargeImageId(long largeImageId)
862 throws SystemException {
863 return fetchByLargeImageId(largeImageId, true);
864 }
865
866
873 public ShoppingItem fetchByLargeImageId(long largeImageId,
874 boolean retrieveFromCache) throws SystemException {
875 Object[] finderArgs = new Object[] { largeImageId };
876
877 Object result = null;
878
879 if (retrieveFromCache) {
880 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
881 finderArgs, this);
882 }
883
884 if (result == null) {
885 StringBundler query = new StringBundler(3);
886
887 query.append(_SQL_SELECT_SHOPPINGITEM_WHERE);
888
889 query.append(_FINDER_COLUMN_LARGEIMAGEID_LARGEIMAGEID_2);
890
891 query.append(ShoppingItemModelImpl.ORDER_BY_JPQL);
892
893 String sql = query.toString();
894
895 Session session = null;
896
897 try {
898 session = openSession();
899
900 Query q = session.createQuery(sql);
901
902 QueryPos qPos = QueryPos.getInstance(q);
903
904 qPos.add(largeImageId);
905
906 List<ShoppingItem> list = q.list();
907
908 result = list;
909
910 ShoppingItem shoppingItem = null;
911
912 if (list.isEmpty()) {
913 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
914 finderArgs, list);
915 }
916 else {
917 shoppingItem = list.get(0);
918
919 cacheResult(shoppingItem);
920
921 if ((shoppingItem.getLargeImageId() != largeImageId)) {
922 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
923 finderArgs, shoppingItem);
924 }
925 }
926
927 return shoppingItem;
928 }
929 catch (Exception e) {
930 throw processException(e);
931 }
932 finally {
933 if (result == null) {
934 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
935 finderArgs);
936 }
937
938 closeSession(session);
939 }
940 }
941 else {
942 if (result instanceof List<?>) {
943 return null;
944 }
945 else {
946 return (ShoppingItem)result;
947 }
948 }
949 }
950
951
959 public List<ShoppingItem> findByG_C(long groupId, long categoryId)
960 throws SystemException {
961 return findByG_C(groupId, categoryId, QueryUtil.ALL_POS,
962 QueryUtil.ALL_POS, null);
963 }
964
965
979 public List<ShoppingItem> findByG_C(long groupId, long categoryId,
980 int start, int end) throws SystemException {
981 return findByG_C(groupId, categoryId, start, end, null);
982 }
983
984
999 public List<ShoppingItem> findByG_C(long groupId, long categoryId,
1000 int start, int end, OrderByComparator orderByComparator)
1001 throws SystemException {
1002 Object[] finderArgs = new Object[] {
1003 groupId, categoryId,
1004
1005 String.valueOf(start), String.valueOf(end),
1006 String.valueOf(orderByComparator)
1007 };
1008
1009 List<ShoppingItem> list = (List<ShoppingItem>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_C,
1010 finderArgs, this);
1011
1012 if (list == null) {
1013 StringBundler query = null;
1014
1015 if (orderByComparator != null) {
1016 query = new StringBundler(4 +
1017 (orderByComparator.getOrderByFields().length * 3));
1018 }
1019 else {
1020 query = new StringBundler(4);
1021 }
1022
1023 query.append(_SQL_SELECT_SHOPPINGITEM_WHERE);
1024
1025 query.append(_FINDER_COLUMN_G_C_GROUPID_2);
1026
1027 query.append(_FINDER_COLUMN_G_C_CATEGORYID_2);
1028
1029 if (orderByComparator != null) {
1030 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1031 orderByComparator);
1032 }
1033
1034 else {
1035 query.append(ShoppingItemModelImpl.ORDER_BY_JPQL);
1036 }
1037
1038 String sql = query.toString();
1039
1040 Session session = null;
1041
1042 try {
1043 session = openSession();
1044
1045 Query q = session.createQuery(sql);
1046
1047 QueryPos qPos = QueryPos.getInstance(q);
1048
1049 qPos.add(groupId);
1050
1051 qPos.add(categoryId);
1052
1053 list = (List<ShoppingItem>)QueryUtil.list(q, getDialect(),
1054 start, end);
1055 }
1056 catch (Exception e) {
1057 throw processException(e);
1058 }
1059 finally {
1060 if (list == null) {
1061 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_C,
1062 finderArgs);
1063 }
1064 else {
1065 cacheResult(list);
1066
1067 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_C,
1068 finderArgs, list);
1069 }
1070
1071 closeSession(session);
1072 }
1073 }
1074
1075 return list;
1076 }
1077
1078
1092 public ShoppingItem findByG_C_First(long groupId, long categoryId,
1093 OrderByComparator orderByComparator)
1094 throws NoSuchItemException, SystemException {
1095 List<ShoppingItem> list = findByG_C(groupId, categoryId, 0, 1,
1096 orderByComparator);
1097
1098 if (list.isEmpty()) {
1099 StringBundler msg = new StringBundler(6);
1100
1101 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1102
1103 msg.append("groupId=");
1104 msg.append(groupId);
1105
1106 msg.append(", categoryId=");
1107 msg.append(categoryId);
1108
1109 msg.append(StringPool.CLOSE_CURLY_BRACE);
1110
1111 throw new NoSuchItemException(msg.toString());
1112 }
1113 else {
1114 return list.get(0);
1115 }
1116 }
1117
1118
1132 public ShoppingItem findByG_C_Last(long groupId, long categoryId,
1133 OrderByComparator orderByComparator)
1134 throws NoSuchItemException, SystemException {
1135 int count = countByG_C(groupId, categoryId);
1136
1137 List<ShoppingItem> list = findByG_C(groupId, categoryId, count - 1,
1138 count, orderByComparator);
1139
1140 if (list.isEmpty()) {
1141 StringBundler msg = new StringBundler(6);
1142
1143 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1144
1145 msg.append("groupId=");
1146 msg.append(groupId);
1147
1148 msg.append(", categoryId=");
1149 msg.append(categoryId);
1150
1151 msg.append(StringPool.CLOSE_CURLY_BRACE);
1152
1153 throw new NoSuchItemException(msg.toString());
1154 }
1155 else {
1156 return list.get(0);
1157 }
1158 }
1159
1160
1175 public ShoppingItem[] findByG_C_PrevAndNext(long itemId, long groupId,
1176 long categoryId, OrderByComparator orderByComparator)
1177 throws NoSuchItemException, SystemException {
1178 ShoppingItem shoppingItem = findByPrimaryKey(itemId);
1179
1180 Session session = null;
1181
1182 try {
1183 session = openSession();
1184
1185 ShoppingItem[] array = new ShoppingItemImpl[3];
1186
1187 array[0] = getByG_C_PrevAndNext(session, shoppingItem, groupId,
1188 categoryId, orderByComparator, true);
1189
1190 array[1] = shoppingItem;
1191
1192 array[2] = getByG_C_PrevAndNext(session, shoppingItem, groupId,
1193 categoryId, orderByComparator, false);
1194
1195 return array;
1196 }
1197 catch (Exception e) {
1198 throw processException(e);
1199 }
1200 finally {
1201 closeSession(session);
1202 }
1203 }
1204
1205 protected ShoppingItem getByG_C_PrevAndNext(Session session,
1206 ShoppingItem shoppingItem, long groupId, long categoryId,
1207 OrderByComparator orderByComparator, boolean previous) {
1208 StringBundler query = null;
1209
1210 if (orderByComparator != null) {
1211 query = new StringBundler(6 +
1212 (orderByComparator.getOrderByFields().length * 6));
1213 }
1214 else {
1215 query = new StringBundler(3);
1216 }
1217
1218 query.append(_SQL_SELECT_SHOPPINGITEM_WHERE);
1219
1220 query.append(_FINDER_COLUMN_G_C_GROUPID_2);
1221
1222 query.append(_FINDER_COLUMN_G_C_CATEGORYID_2);
1223
1224 if (orderByComparator != null) {
1225 String[] orderByFields = orderByComparator.getOrderByFields();
1226
1227 if (orderByFields.length > 0) {
1228 query.append(WHERE_AND);
1229 }
1230
1231 for (int i = 0; i < orderByFields.length; i++) {
1232 query.append(_ORDER_BY_ENTITY_ALIAS);
1233 query.append(orderByFields[i]);
1234
1235 if ((i + 1) < orderByFields.length) {
1236 if (orderByComparator.isAscending() ^ previous) {
1237 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1238 }
1239 else {
1240 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1241 }
1242 }
1243 else {
1244 if (orderByComparator.isAscending() ^ previous) {
1245 query.append(WHERE_GREATER_THAN);
1246 }
1247 else {
1248 query.append(WHERE_LESSER_THAN);
1249 }
1250 }
1251 }
1252
1253 query.append(ORDER_BY_CLAUSE);
1254
1255 for (int i = 0; i < orderByFields.length; i++) {
1256 query.append(_ORDER_BY_ENTITY_ALIAS);
1257 query.append(orderByFields[i]);
1258
1259 if ((i + 1) < orderByFields.length) {
1260 if (orderByComparator.isAscending() ^ previous) {
1261 query.append(ORDER_BY_ASC_HAS_NEXT);
1262 }
1263 else {
1264 query.append(ORDER_BY_DESC_HAS_NEXT);
1265 }
1266 }
1267 else {
1268 if (orderByComparator.isAscending() ^ previous) {
1269 query.append(ORDER_BY_ASC);
1270 }
1271 else {
1272 query.append(ORDER_BY_DESC);
1273 }
1274 }
1275 }
1276 }
1277
1278 else {
1279 query.append(ShoppingItemModelImpl.ORDER_BY_JPQL);
1280 }
1281
1282 String sql = query.toString();
1283
1284 Query q = session.createQuery(sql);
1285
1286 q.setFirstResult(0);
1287 q.setMaxResults(2);
1288
1289 QueryPos qPos = QueryPos.getInstance(q);
1290
1291 qPos.add(groupId);
1292
1293 qPos.add(categoryId);
1294
1295 if (orderByComparator != null) {
1296 Object[] values = orderByComparator.getOrderByValues(shoppingItem);
1297
1298 for (Object value : values) {
1299 qPos.add(value);
1300 }
1301 }
1302
1303 List<ShoppingItem> list = q.list();
1304
1305 if (list.size() == 2) {
1306 return list.get(1);
1307 }
1308 else {
1309 return null;
1310 }
1311 }
1312
1313
1321 public List<ShoppingItem> filterFindByG_C(long groupId, long categoryId)
1322 throws SystemException {
1323 return filterFindByG_C(groupId, categoryId, QueryUtil.ALL_POS,
1324 QueryUtil.ALL_POS, null);
1325 }
1326
1327
1341 public List<ShoppingItem> filterFindByG_C(long groupId, long categoryId,
1342 int start, int end) throws SystemException {
1343 return filterFindByG_C(groupId, categoryId, start, end, null);
1344 }
1345
1346
1361 public List<ShoppingItem> filterFindByG_C(long groupId, long categoryId,
1362 int start, int end, OrderByComparator orderByComparator)
1363 throws SystemException {
1364 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1365 return findByG_C(groupId, categoryId, start, end, orderByComparator);
1366 }
1367
1368 StringBundler query = null;
1369
1370 if (orderByComparator != null) {
1371 query = new StringBundler(4 +
1372 (orderByComparator.getOrderByFields().length * 3));
1373 }
1374 else {
1375 query = new StringBundler(4);
1376 }
1377
1378 if (getDB().isSupportsInlineDistinct()) {
1379 query.append(_FILTER_SQL_SELECT_SHOPPINGITEM_WHERE);
1380 }
1381 else {
1382 query.append(_FILTER_SQL_SELECT_SHOPPINGITEM_NO_INLINE_DISTINCT_WHERE_1);
1383 }
1384
1385 query.append(_FINDER_COLUMN_G_C_GROUPID_2);
1386
1387 query.append(_FINDER_COLUMN_G_C_CATEGORYID_2);
1388
1389 if (!getDB().isSupportsInlineDistinct()) {
1390 query.append(_FILTER_SQL_SELECT_SHOPPINGITEM_NO_INLINE_DISTINCT_WHERE_2);
1391 }
1392
1393 if (orderByComparator != null) {
1394 if (getDB().isSupportsInlineDistinct()) {
1395 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1396 orderByComparator);
1397 }
1398 else {
1399 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1400 orderByComparator);
1401 }
1402 }
1403
1404 else {
1405 if (getDB().isSupportsInlineDistinct()) {
1406 query.append(ShoppingItemModelImpl.ORDER_BY_JPQL);
1407 }
1408 else {
1409 query.append(ShoppingItemModelImpl.ORDER_BY_SQL);
1410 }
1411 }
1412
1413 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1414 ShoppingItem.class.getName(), _FILTER_COLUMN_PK,
1415 _FILTER_COLUMN_USERID, groupId);
1416
1417 Session session = null;
1418
1419 try {
1420 session = openSession();
1421
1422 SQLQuery q = session.createSQLQuery(sql);
1423
1424 if (getDB().isSupportsInlineDistinct()) {
1425 q.addEntity(_FILTER_ENTITY_ALIAS, ShoppingItemImpl.class);
1426 }
1427 else {
1428 q.addEntity(_FILTER_ENTITY_TABLE, ShoppingItemImpl.class);
1429 }
1430
1431 QueryPos qPos = QueryPos.getInstance(q);
1432
1433 qPos.add(groupId);
1434
1435 qPos.add(categoryId);
1436
1437 return (List<ShoppingItem>)QueryUtil.list(q, getDialect(), start,
1438 end);
1439 }
1440 catch (Exception e) {
1441 throw processException(e);
1442 }
1443 finally {
1444 closeSession(session);
1445 }
1446 }
1447
1448
1457 public ShoppingItem findByC_S(long companyId, String sku)
1458 throws NoSuchItemException, SystemException {
1459 ShoppingItem shoppingItem = fetchByC_S(companyId, sku);
1460
1461 if (shoppingItem == null) {
1462 StringBundler msg = new StringBundler(6);
1463
1464 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1465
1466 msg.append("companyId=");
1467 msg.append(companyId);
1468
1469 msg.append(", sku=");
1470 msg.append(sku);
1471
1472 msg.append(StringPool.CLOSE_CURLY_BRACE);
1473
1474 if (_log.isWarnEnabled()) {
1475 _log.warn(msg.toString());
1476 }
1477
1478 throw new NoSuchItemException(msg.toString());
1479 }
1480
1481 return shoppingItem;
1482 }
1483
1484
1492 public ShoppingItem fetchByC_S(long companyId, String sku)
1493 throws SystemException {
1494 return fetchByC_S(companyId, sku, true);
1495 }
1496
1497
1505 public ShoppingItem fetchByC_S(long companyId, String sku,
1506 boolean retrieveFromCache) throws SystemException {
1507 Object[] finderArgs = new Object[] { companyId, sku };
1508
1509 Object result = null;
1510
1511 if (retrieveFromCache) {
1512 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_S,
1513 finderArgs, this);
1514 }
1515
1516 if (result == null) {
1517 StringBundler query = new StringBundler(4);
1518
1519 query.append(_SQL_SELECT_SHOPPINGITEM_WHERE);
1520
1521 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
1522
1523 if (sku == null) {
1524 query.append(_FINDER_COLUMN_C_S_SKU_1);
1525 }
1526 else {
1527 if (sku.equals(StringPool.BLANK)) {
1528 query.append(_FINDER_COLUMN_C_S_SKU_3);
1529 }
1530 else {
1531 query.append(_FINDER_COLUMN_C_S_SKU_2);
1532 }
1533 }
1534
1535 query.append(ShoppingItemModelImpl.ORDER_BY_JPQL);
1536
1537 String sql = query.toString();
1538
1539 Session session = null;
1540
1541 try {
1542 session = openSession();
1543
1544 Query q = session.createQuery(sql);
1545
1546 QueryPos qPos = QueryPos.getInstance(q);
1547
1548 qPos.add(companyId);
1549
1550 if (sku != null) {
1551 qPos.add(sku);
1552 }
1553
1554 List<ShoppingItem> list = q.list();
1555
1556 result = list;
1557
1558 ShoppingItem shoppingItem = null;
1559
1560 if (list.isEmpty()) {
1561 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_S,
1562 finderArgs, list);
1563 }
1564 else {
1565 shoppingItem = list.get(0);
1566
1567 cacheResult(shoppingItem);
1568
1569 if ((shoppingItem.getCompanyId() != companyId) ||
1570 (shoppingItem.getSku() == null) ||
1571 !shoppingItem.getSku().equals(sku)) {
1572 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_S,
1573 finderArgs, shoppingItem);
1574 }
1575 }
1576
1577 return shoppingItem;
1578 }
1579 catch (Exception e) {
1580 throw processException(e);
1581 }
1582 finally {
1583 if (result == null) {
1584 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_S,
1585 finderArgs);
1586 }
1587
1588 closeSession(session);
1589 }
1590 }
1591 else {
1592 if (result instanceof List<?>) {
1593 return null;
1594 }
1595 else {
1596 return (ShoppingItem)result;
1597 }
1598 }
1599 }
1600
1601
1607 public List<ShoppingItem> findAll() throws SystemException {
1608 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1609 }
1610
1611
1623 public List<ShoppingItem> findAll(int start, int end)
1624 throws SystemException {
1625 return findAll(start, end, null);
1626 }
1627
1628
1641 public List<ShoppingItem> findAll(int start, int end,
1642 OrderByComparator orderByComparator) throws SystemException {
1643 Object[] finderArgs = new Object[] {
1644 String.valueOf(start), String.valueOf(end),
1645 String.valueOf(orderByComparator)
1646 };
1647
1648 List<ShoppingItem> list = (List<ShoppingItem>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1649 finderArgs, this);
1650
1651 if (list == null) {
1652 StringBundler query = null;
1653 String sql = null;
1654
1655 if (orderByComparator != null) {
1656 query = new StringBundler(2 +
1657 (orderByComparator.getOrderByFields().length * 3));
1658
1659 query.append(_SQL_SELECT_SHOPPINGITEM);
1660
1661 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1662 orderByComparator);
1663
1664 sql = query.toString();
1665 }
1666 else {
1667 sql = _SQL_SELECT_SHOPPINGITEM.concat(ShoppingItemModelImpl.ORDER_BY_JPQL);
1668 }
1669
1670 Session session = null;
1671
1672 try {
1673 session = openSession();
1674
1675 Query q = session.createQuery(sql);
1676
1677 if (orderByComparator == null) {
1678 list = (List<ShoppingItem>)QueryUtil.list(q, getDialect(),
1679 start, end, false);
1680
1681 Collections.sort(list);
1682 }
1683 else {
1684 list = (List<ShoppingItem>)QueryUtil.list(q, getDialect(),
1685 start, end);
1686 }
1687 }
1688 catch (Exception e) {
1689 throw processException(e);
1690 }
1691 finally {
1692 if (list == null) {
1693 FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
1694 finderArgs);
1695 }
1696 else {
1697 cacheResult(list);
1698
1699 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
1700 list);
1701 }
1702
1703 closeSession(session);
1704 }
1705 }
1706
1707 return list;
1708 }
1709
1710
1716 public void removeBySmallImageId(long smallImageId)
1717 throws NoSuchItemException, SystemException {
1718 ShoppingItem shoppingItem = findBySmallImageId(smallImageId);
1719
1720 remove(shoppingItem);
1721 }
1722
1723
1729 public void removeByMediumImageId(long mediumImageId)
1730 throws NoSuchItemException, SystemException {
1731 ShoppingItem shoppingItem = findByMediumImageId(mediumImageId);
1732
1733 remove(shoppingItem);
1734 }
1735
1736
1742 public void removeByLargeImageId(long largeImageId)
1743 throws NoSuchItemException, SystemException {
1744 ShoppingItem shoppingItem = findByLargeImageId(largeImageId);
1745
1746 remove(shoppingItem);
1747 }
1748
1749
1756 public void removeByG_C(long groupId, long categoryId)
1757 throws SystemException {
1758 for (ShoppingItem shoppingItem : findByG_C(groupId, categoryId)) {
1759 remove(shoppingItem);
1760 }
1761 }
1762
1763
1770 public void removeByC_S(long companyId, String sku)
1771 throws NoSuchItemException, SystemException {
1772 ShoppingItem shoppingItem = findByC_S(companyId, sku);
1773
1774 remove(shoppingItem);
1775 }
1776
1777
1782 public void removeAll() throws SystemException {
1783 for (ShoppingItem shoppingItem : findAll()) {
1784 remove(shoppingItem);
1785 }
1786 }
1787
1788
1795 public int countBySmallImageId(long smallImageId) throws SystemException {
1796 Object[] finderArgs = new Object[] { smallImageId };
1797
1798 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
1799 finderArgs, this);
1800
1801 if (count == null) {
1802 StringBundler query = new StringBundler(2);
1803
1804 query.append(_SQL_COUNT_SHOPPINGITEM_WHERE);
1805
1806 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
1807
1808 String sql = query.toString();
1809
1810 Session session = null;
1811
1812 try {
1813 session = openSession();
1814
1815 Query q = session.createQuery(sql);
1816
1817 QueryPos qPos = QueryPos.getInstance(q);
1818
1819 qPos.add(smallImageId);
1820
1821 count = (Long)q.uniqueResult();
1822 }
1823 catch (Exception e) {
1824 throw processException(e);
1825 }
1826 finally {
1827 if (count == null) {
1828 count = Long.valueOf(0);
1829 }
1830
1831 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
1832 finderArgs, count);
1833
1834 closeSession(session);
1835 }
1836 }
1837
1838 return count.intValue();
1839 }
1840
1841
1848 public int countByMediumImageId(long mediumImageId)
1849 throws SystemException {
1850 Object[] finderArgs = new Object[] { mediumImageId };
1851
1852 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_MEDIUMIMAGEID,
1853 finderArgs, this);
1854
1855 if (count == null) {
1856 StringBundler query = new StringBundler(2);
1857
1858 query.append(_SQL_COUNT_SHOPPINGITEM_WHERE);
1859
1860 query.append(_FINDER_COLUMN_MEDIUMIMAGEID_MEDIUMIMAGEID_2);
1861
1862 String sql = query.toString();
1863
1864 Session session = null;
1865
1866 try {
1867 session = openSession();
1868
1869 Query q = session.createQuery(sql);
1870
1871 QueryPos qPos = QueryPos.getInstance(q);
1872
1873 qPos.add(mediumImageId);
1874
1875 count = (Long)q.uniqueResult();
1876 }
1877 catch (Exception e) {
1878 throw processException(e);
1879 }
1880 finally {
1881 if (count == null) {
1882 count = Long.valueOf(0);
1883 }
1884
1885 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_MEDIUMIMAGEID,
1886 finderArgs, count);
1887
1888 closeSession(session);
1889 }
1890 }
1891
1892 return count.intValue();
1893 }
1894
1895
1902 public int countByLargeImageId(long largeImageId) throws SystemException {
1903 Object[] finderArgs = new Object[] { largeImageId };
1904
1905 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LARGEIMAGEID,
1906 finderArgs, this);
1907
1908 if (count == null) {
1909 StringBundler query = new StringBundler(2);
1910
1911 query.append(_SQL_COUNT_SHOPPINGITEM_WHERE);
1912
1913 query.append(_FINDER_COLUMN_LARGEIMAGEID_LARGEIMAGEID_2);
1914
1915 String sql = query.toString();
1916
1917 Session session = null;
1918
1919 try {
1920 session = openSession();
1921
1922 Query q = session.createQuery(sql);
1923
1924 QueryPos qPos = QueryPos.getInstance(q);
1925
1926 qPos.add(largeImageId);
1927
1928 count = (Long)q.uniqueResult();
1929 }
1930 catch (Exception e) {
1931 throw processException(e);
1932 }
1933 finally {
1934 if (count == null) {
1935 count = Long.valueOf(0);
1936 }
1937
1938 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LARGEIMAGEID,
1939 finderArgs, count);
1940
1941 closeSession(session);
1942 }
1943 }
1944
1945 return count.intValue();
1946 }
1947
1948
1956 public int countByG_C(long groupId, long categoryId)
1957 throws SystemException {
1958 Object[] finderArgs = new Object[] { groupId, categoryId };
1959
1960 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C,
1961 finderArgs, this);
1962
1963 if (count == null) {
1964 StringBundler query = new StringBundler(3);
1965
1966 query.append(_SQL_COUNT_SHOPPINGITEM_WHERE);
1967
1968 query.append(_FINDER_COLUMN_G_C_GROUPID_2);
1969
1970 query.append(_FINDER_COLUMN_G_C_CATEGORYID_2);
1971
1972 String sql = query.toString();
1973
1974 Session session = null;
1975
1976 try {
1977 session = openSession();
1978
1979 Query q = session.createQuery(sql);
1980
1981 QueryPos qPos = QueryPos.getInstance(q);
1982
1983 qPos.add(groupId);
1984
1985 qPos.add(categoryId);
1986
1987 count = (Long)q.uniqueResult();
1988 }
1989 catch (Exception e) {
1990 throw processException(e);
1991 }
1992 finally {
1993 if (count == null) {
1994 count = Long.valueOf(0);
1995 }
1996
1997 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C, finderArgs,
1998 count);
1999
2000 closeSession(session);
2001 }
2002 }
2003
2004 return count.intValue();
2005 }
2006
2007
2015 public int filterCountByG_C(long groupId, long categoryId)
2016 throws SystemException {
2017 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2018 return countByG_C(groupId, categoryId);
2019 }
2020
2021 StringBundler query = new StringBundler(3);
2022
2023 query.append(_FILTER_SQL_COUNT_SHOPPINGITEM_WHERE);
2024
2025 query.append(_FINDER_COLUMN_G_C_GROUPID_2);
2026
2027 query.append(_FINDER_COLUMN_G_C_CATEGORYID_2);
2028
2029 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2030 ShoppingItem.class.getName(), _FILTER_COLUMN_PK,
2031 _FILTER_COLUMN_USERID, groupId);
2032
2033 Session session = null;
2034
2035 try {
2036 session = openSession();
2037
2038 SQLQuery q = session.createSQLQuery(sql);
2039
2040 q.addScalar(COUNT_COLUMN_NAME,
2041 com.liferay.portal.kernel.dao.orm.Type.LONG);
2042
2043 QueryPos qPos = QueryPos.getInstance(q);
2044
2045 qPos.add(groupId);
2046
2047 qPos.add(categoryId);
2048
2049 Long count = (Long)q.uniqueResult();
2050
2051 return count.intValue();
2052 }
2053 catch (Exception e) {
2054 throw processException(e);
2055 }
2056 finally {
2057 closeSession(session);
2058 }
2059 }
2060
2061
2069 public int countByC_S(long companyId, String sku) throws SystemException {
2070 Object[] finderArgs = new Object[] { companyId, sku };
2071
2072 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_S,
2073 finderArgs, this);
2074
2075 if (count == null) {
2076 StringBundler query = new StringBundler(3);
2077
2078 query.append(_SQL_COUNT_SHOPPINGITEM_WHERE);
2079
2080 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
2081
2082 if (sku == null) {
2083 query.append(_FINDER_COLUMN_C_S_SKU_1);
2084 }
2085 else {
2086 if (sku.equals(StringPool.BLANK)) {
2087 query.append(_FINDER_COLUMN_C_S_SKU_3);
2088 }
2089 else {
2090 query.append(_FINDER_COLUMN_C_S_SKU_2);
2091 }
2092 }
2093
2094 String sql = query.toString();
2095
2096 Session session = null;
2097
2098 try {
2099 session = openSession();
2100
2101 Query q = session.createQuery(sql);
2102
2103 QueryPos qPos = QueryPos.getInstance(q);
2104
2105 qPos.add(companyId);
2106
2107 if (sku != null) {
2108 qPos.add(sku);
2109 }
2110
2111 count = (Long)q.uniqueResult();
2112 }
2113 catch (Exception e) {
2114 throw processException(e);
2115 }
2116 finally {
2117 if (count == null) {
2118 count = Long.valueOf(0);
2119 }
2120
2121 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_S, finderArgs,
2122 count);
2123
2124 closeSession(session);
2125 }
2126 }
2127
2128 return count.intValue();
2129 }
2130
2131
2137 public int countAll() throws SystemException {
2138 Object[] finderArgs = new Object[0];
2139
2140 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2141 finderArgs, this);
2142
2143 if (count == null) {
2144 Session session = null;
2145
2146 try {
2147 session = openSession();
2148
2149 Query q = session.createQuery(_SQL_COUNT_SHOPPINGITEM);
2150
2151 count = (Long)q.uniqueResult();
2152 }
2153 catch (Exception e) {
2154 throw processException(e);
2155 }
2156 finally {
2157 if (count == null) {
2158 count = Long.valueOf(0);
2159 }
2160
2161 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2162 count);
2163
2164 closeSession(session);
2165 }
2166 }
2167
2168 return count.intValue();
2169 }
2170
2171
2178 public List<com.liferay.portlet.shopping.model.ShoppingItemPrice> getShoppingItemPrices(
2179 long pk) throws SystemException {
2180 return getShoppingItemPrices(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
2181 }
2182
2183
2196 public List<com.liferay.portlet.shopping.model.ShoppingItemPrice> getShoppingItemPrices(
2197 long pk, int start, int end) throws SystemException {
2198 return getShoppingItemPrices(pk, start, end, null);
2199 }
2200
2201 public static final FinderPath FINDER_PATH_GET_SHOPPINGITEMPRICES = new FinderPath(com.liferay.portlet.shopping.model.impl.ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
2202 com.liferay.portlet.shopping.model.impl.ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
2203 com.liferay.portlet.shopping.service.persistence.ShoppingItemPricePersistenceImpl.FINDER_CLASS_NAME_LIST,
2204 "getShoppingItemPrices",
2205 new String[] {
2206 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
2207 "com.liferay.portal.kernel.util.OrderByComparator"
2208 });
2209
2210
2224 public List<com.liferay.portlet.shopping.model.ShoppingItemPrice> getShoppingItemPrices(
2225 long pk, int start, int end, OrderByComparator orderByComparator)
2226 throws SystemException {
2227 Object[] finderArgs = new Object[] {
2228 pk, String.valueOf(start), String.valueOf(end),
2229 String.valueOf(orderByComparator)
2230 };
2231
2232 List<com.liferay.portlet.shopping.model.ShoppingItemPrice> list = (List<com.liferay.portlet.shopping.model.ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_GET_SHOPPINGITEMPRICES,
2233 finderArgs, this);
2234
2235 if (list == null) {
2236 Session session = null;
2237
2238 try {
2239 session = openSession();
2240
2241 String sql = null;
2242
2243 if (orderByComparator != null) {
2244 sql = _SQL_GETSHOPPINGITEMPRICES.concat(ORDER_BY_CLAUSE)
2245 .concat(orderByComparator.getOrderBy());
2246 }
2247 else {
2248 sql = _SQL_GETSHOPPINGITEMPRICES.concat(com.liferay.portlet.shopping.model.impl.ShoppingItemPriceModelImpl.ORDER_BY_SQL);
2249 }
2250
2251 SQLQuery q = session.createSQLQuery(sql);
2252
2253 q.addEntity("ShoppingItemPrice",
2254 com.liferay.portlet.shopping.model.impl.ShoppingItemPriceImpl.class);
2255
2256 QueryPos qPos = QueryPos.getInstance(q);
2257
2258 qPos.add(pk);
2259
2260 list = (List<com.liferay.portlet.shopping.model.ShoppingItemPrice>)QueryUtil.list(q,
2261 getDialect(), start, end);
2262 }
2263 catch (Exception e) {
2264 throw processException(e);
2265 }
2266 finally {
2267 if (list == null) {
2268 FinderCacheUtil.removeResult(FINDER_PATH_GET_SHOPPINGITEMPRICES,
2269 finderArgs);
2270 }
2271 else {
2272 shoppingItemPricePersistence.cacheResult(list);
2273
2274 FinderCacheUtil.putResult(FINDER_PATH_GET_SHOPPINGITEMPRICES,
2275 finderArgs, list);
2276 }
2277
2278 closeSession(session);
2279 }
2280 }
2281
2282 return list;
2283 }
2284
2285 public static final FinderPath FINDER_PATH_GET_SHOPPINGITEMPRICES_SIZE = new FinderPath(com.liferay.portlet.shopping.model.impl.ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
2286 com.liferay.portlet.shopping.model.impl.ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
2287 com.liferay.portlet.shopping.service.persistence.ShoppingItemPricePersistenceImpl.FINDER_CLASS_NAME_LIST,
2288 "getShoppingItemPricesSize", new String[] { Long.class.getName() });
2289
2290
2297 public int getShoppingItemPricesSize(long pk) throws SystemException {
2298 Object[] finderArgs = new Object[] { pk };
2299
2300 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SHOPPINGITEMPRICES_SIZE,
2301 finderArgs, this);
2302
2303 if (count == null) {
2304 Session session = null;
2305
2306 try {
2307 session = openSession();
2308
2309 SQLQuery q = session.createSQLQuery(_SQL_GETSHOPPINGITEMPRICESSIZE);
2310
2311 q.addScalar(COUNT_COLUMN_NAME,
2312 com.liferay.portal.kernel.dao.orm.Type.LONG);
2313
2314 QueryPos qPos = QueryPos.getInstance(q);
2315
2316 qPos.add(pk);
2317
2318 count = (Long)q.uniqueResult();
2319 }
2320 catch (Exception e) {
2321 throw processException(e);
2322 }
2323 finally {
2324 if (count == null) {
2325 count = Long.valueOf(0);
2326 }
2327
2328 FinderCacheUtil.putResult(FINDER_PATH_GET_SHOPPINGITEMPRICES_SIZE,
2329 finderArgs, count);
2330
2331 closeSession(session);
2332 }
2333 }
2334
2335 return count.intValue();
2336 }
2337
2338 public static final FinderPath FINDER_PATH_CONTAINS_SHOPPINGITEMPRICE = new FinderPath(com.liferay.portlet.shopping.model.impl.ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
2339 com.liferay.portlet.shopping.model.impl.ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
2340 com.liferay.portlet.shopping.service.persistence.ShoppingItemPricePersistenceImpl.FINDER_CLASS_NAME_LIST,
2341 "containsShoppingItemPrice",
2342 new String[] { Long.class.getName(), Long.class.getName() });
2343
2344
2352 public boolean containsShoppingItemPrice(long pk, long shoppingItemPricePK)
2353 throws SystemException {
2354 Object[] finderArgs = new Object[] { pk, shoppingItemPricePK };
2355
2356 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SHOPPINGITEMPRICE,
2357 finderArgs, this);
2358
2359 if (value == null) {
2360 try {
2361 value = Boolean.valueOf(containsShoppingItemPrice.contains(pk,
2362 shoppingItemPricePK));
2363 }
2364 catch (Exception e) {
2365 throw processException(e);
2366 }
2367 finally {
2368 if (value == null) {
2369 value = Boolean.FALSE;
2370 }
2371
2372 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SHOPPINGITEMPRICE,
2373 finderArgs, value);
2374 }
2375 }
2376
2377 return value.booleanValue();
2378 }
2379
2380
2387 public boolean containsShoppingItemPrices(long pk)
2388 throws SystemException {
2389 if (getShoppingItemPricesSize(pk) > 0) {
2390 return true;
2391 }
2392 else {
2393 return false;
2394 }
2395 }
2396
2397
2400 public void afterPropertiesSet() {
2401 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2402 com.liferay.portal.util.PropsUtil.get(
2403 "value.object.listener.com.liferay.portlet.shopping.model.ShoppingItem")));
2404
2405 if (listenerClassNames.length > 0) {
2406 try {
2407 List<ModelListener<ShoppingItem>> listenersList = new ArrayList<ModelListener<ShoppingItem>>();
2408
2409 for (String listenerClassName : listenerClassNames) {
2410 listenersList.add((ModelListener<ShoppingItem>)InstanceFactory.newInstance(
2411 listenerClassName));
2412 }
2413
2414 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2415 }
2416 catch (Exception e) {
2417 _log.error(e);
2418 }
2419 }
2420
2421 containsShoppingItemPrice = new ContainsShoppingItemPrice(this);
2422 }
2423
2424 public void destroy() {
2425 EntityCacheUtil.removeCache(ShoppingItemImpl.class.getName());
2426 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2427 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
2428 }
2429
2430 @BeanReference(type = ShoppingCartPersistence.class)
2431 protected ShoppingCartPersistence shoppingCartPersistence;
2432 @BeanReference(type = ShoppingCategoryPersistence.class)
2433 protected ShoppingCategoryPersistence shoppingCategoryPersistence;
2434 @BeanReference(type = ShoppingCouponPersistence.class)
2435 protected ShoppingCouponPersistence shoppingCouponPersistence;
2436 @BeanReference(type = ShoppingItemPersistence.class)
2437 protected ShoppingItemPersistence shoppingItemPersistence;
2438 @BeanReference(type = ShoppingItemFieldPersistence.class)
2439 protected ShoppingItemFieldPersistence shoppingItemFieldPersistence;
2440 @BeanReference(type = ShoppingItemPricePersistence.class)
2441 protected ShoppingItemPricePersistence shoppingItemPricePersistence;
2442 @BeanReference(type = ShoppingOrderPersistence.class)
2443 protected ShoppingOrderPersistence shoppingOrderPersistence;
2444 @BeanReference(type = ShoppingOrderItemPersistence.class)
2445 protected ShoppingOrderItemPersistence shoppingOrderItemPersistence;
2446 @BeanReference(type = ImagePersistence.class)
2447 protected ImagePersistence imagePersistence;
2448 @BeanReference(type = ResourcePersistence.class)
2449 protected ResourcePersistence resourcePersistence;
2450 @BeanReference(type = UserPersistence.class)
2451 protected UserPersistence userPersistence;
2452 protected ContainsShoppingItemPrice containsShoppingItemPrice;
2453
2454 protected class ContainsShoppingItemPrice {
2455 protected ContainsShoppingItemPrice(
2456 ShoppingItemPersistenceImpl persistenceImpl) {
2457 super();
2458
2459 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2460 _SQL_CONTAINSSHOPPINGITEMPRICE,
2461 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
2462 RowMapper.COUNT);
2463 }
2464
2465 protected boolean contains(long itemId, long itemPriceId) {
2466 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2467 new Long(itemId), new Long(itemPriceId)
2468 });
2469
2470 if (results.size() > 0) {
2471 Integer count = results.get(0);
2472
2473 if (count.intValue() > 0) {
2474 return true;
2475 }
2476 }
2477
2478 return false;
2479 }
2480
2481 private MappingSqlQuery<Integer> _mappingSqlQuery;
2482 }
2483
2484 private static final String _SQL_SELECT_SHOPPINGITEM = "SELECT shoppingItem FROM ShoppingItem shoppingItem";
2485 private static final String _SQL_SELECT_SHOPPINGITEM_WHERE = "SELECT shoppingItem FROM ShoppingItem shoppingItem WHERE ";
2486 private static final String _SQL_COUNT_SHOPPINGITEM = "SELECT COUNT(shoppingItem) FROM ShoppingItem shoppingItem";
2487 private static final String _SQL_COUNT_SHOPPINGITEM_WHERE = "SELECT COUNT(shoppingItem) FROM ShoppingItem shoppingItem WHERE ";
2488 private static final String _SQL_GETSHOPPINGITEMPRICES = "SELECT {ShoppingItemPrice.*} FROM ShoppingItemPrice INNER JOIN ShoppingItem ON (ShoppingItem.itemId = ShoppingItemPrice.itemId) WHERE (ShoppingItem.itemId = ?)";
2489 private static final String _SQL_GETSHOPPINGITEMPRICESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM ShoppingItemPrice WHERE itemId = ?";
2490 private static final String _SQL_CONTAINSSHOPPINGITEMPRICE = "SELECT COUNT(*) AS COUNT_VALUE FROM ShoppingItemPrice WHERE itemId = ? AND itemPriceId = ?";
2491 private static final String _FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2 = "shoppingItem.smallImageId = ?";
2492 private static final String _FINDER_COLUMN_MEDIUMIMAGEID_MEDIUMIMAGEID_2 = "shoppingItem.mediumImageId = ?";
2493 private static final String _FINDER_COLUMN_LARGEIMAGEID_LARGEIMAGEID_2 = "shoppingItem.largeImageId = ?";
2494 private static final String _FINDER_COLUMN_G_C_GROUPID_2 = "shoppingItem.groupId = ? AND ";
2495 private static final String _FINDER_COLUMN_G_C_CATEGORYID_2 = "shoppingItem.categoryId = ?";
2496 private static final String _FINDER_COLUMN_C_S_COMPANYID_2 = "shoppingItem.companyId = ? AND ";
2497 private static final String _FINDER_COLUMN_C_S_SKU_1 = "shoppingItem.sku IS NULL";
2498 private static final String _FINDER_COLUMN_C_S_SKU_2 = "shoppingItem.sku = ?";
2499 private static final String _FINDER_COLUMN_C_S_SKU_3 = "(shoppingItem.sku IS NULL OR shoppingItem.sku = ?)";
2500 private static final String _FILTER_SQL_SELECT_SHOPPINGITEM_WHERE = "SELECT DISTINCT {shoppingItem.*} FROM ShoppingItem shoppingItem WHERE ";
2501 private static final String _FILTER_SQL_SELECT_SHOPPINGITEM_NO_INLINE_DISTINCT_WHERE_1 =
2502 "SELECT {ShoppingItem.*} FROM (SELECT DISTINCT shoppingItem.itemId FROM ShoppingItem shoppingItem WHERE ";
2503 private static final String _FILTER_SQL_SELECT_SHOPPINGITEM_NO_INLINE_DISTINCT_WHERE_2 =
2504 ") TEMP_TABLE INNER JOIN ShoppingItem ON TEMP_TABLE.itemId = ShoppingItem.itemId";
2505 private static final String _FILTER_SQL_COUNT_SHOPPINGITEM_WHERE = "SELECT COUNT(DISTINCT shoppingItem.itemId) AS COUNT_VALUE FROM ShoppingItem shoppingItem WHERE ";
2506 private static final String _FILTER_COLUMN_PK = "shoppingItem.itemId";
2507 private static final String _FILTER_COLUMN_USERID = "shoppingItem.userId";
2508 private static final String _FILTER_ENTITY_ALIAS = "shoppingItem";
2509 private static final String _FILTER_ENTITY_TABLE = "ShoppingItem";
2510 private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingItem.";
2511 private static final String _ORDER_BY_ENTITY_TABLE = "ShoppingItem.";
2512 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingItem exists with the primary key ";
2513 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingItem exists with the key {";
2514 private static Log _log = LogFactoryUtil.getLog(ShoppingItemPersistenceImpl.class);
2515 }