1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.softwarecatalog.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.kernel.annotation.BeanReference;
19  import com.liferay.portal.kernel.cache.CacheRegistry;
20  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
21  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderPath;
24  import com.liferay.portal.kernel.dao.orm.Query;
25  import com.liferay.portal.kernel.dao.orm.QueryPos;
26  import com.liferay.portal.kernel.dao.orm.QueryUtil;
27  import com.liferay.portal.kernel.dao.orm.Session;
28  import com.liferay.portal.kernel.exception.SystemException;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.OrderByComparator;
33  import com.liferay.portal.kernel.util.StringBundler;
34  import com.liferay.portal.kernel.util.StringPool;
35  import com.liferay.portal.kernel.util.StringUtil;
36  import com.liferay.portal.model.ModelListener;
37  import com.liferay.portal.service.persistence.BatchSessionUtil;
38  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
39  
40  import com.liferay.portlet.softwarecatalog.NoSuchProductScreenshotException;
41  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
42  import com.liferay.portlet.softwarecatalog.model.impl.SCProductScreenshotImpl;
43  import com.liferay.portlet.softwarecatalog.model.impl.SCProductScreenshotModelImpl;
44  
45  import java.io.Serializable;
46  
47  import java.util.ArrayList;
48  import java.util.Collections;
49  import java.util.List;
50  
51  /**
52   * <a href="SCProductScreenshotPersistenceImpl.java.html"><b><i>View Source</i></b></a>
53   *
54   * <p>
55   * ServiceBuilder generated this class. Modifications in this class will be
56   * overwritten the next time is generated.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       SCProductScreenshotPersistence
61   * @see       SCProductScreenshotUtil
62   * @generated
63   */
64  public class SCProductScreenshotPersistenceImpl extends BasePersistenceImpl<SCProductScreenshot>
65      implements SCProductScreenshotPersistence {
66      public static final String FINDER_CLASS_NAME_ENTITY = SCProductScreenshotImpl.class.getName();
67      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
68          ".List";
69      public static final FinderPath FINDER_PATH_FIND_BY_PRODUCTENTRYID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
70              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
71              FINDER_CLASS_NAME_LIST, "findByProductEntryId",
72              new String[] { Long.class.getName() });
73      public static final FinderPath FINDER_PATH_FIND_BY_OBC_PRODUCTENTRYID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
74              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
75              FINDER_CLASS_NAME_LIST, "findByProductEntryId",
76              new String[] {
77                  Long.class.getName(),
78                  
79              "java.lang.Integer", "java.lang.Integer",
80                  "com.liferay.portal.kernel.util.OrderByComparator"
81              });
82      public static final FinderPath FINDER_PATH_COUNT_BY_PRODUCTENTRYID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
83              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
84              FINDER_CLASS_NAME_LIST, "countByProductEntryId",
85              new String[] { Long.class.getName() });
86      public static final FinderPath FINDER_PATH_FETCH_BY_THUMBNAILID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
87              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
88              FINDER_CLASS_NAME_ENTITY, "fetchByThumbnailId",
89              new String[] { Long.class.getName() });
90      public static final FinderPath FINDER_PATH_COUNT_BY_THUMBNAILID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
91              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
92              FINDER_CLASS_NAME_LIST, "countByThumbnailId",
93              new String[] { Long.class.getName() });
94      public static final FinderPath FINDER_PATH_FETCH_BY_FULLIMAGEID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
95              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
96              FINDER_CLASS_NAME_ENTITY, "fetchByFullImageId",
97              new String[] { Long.class.getName() });
98      public static final FinderPath FINDER_PATH_COUNT_BY_FULLIMAGEID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
99              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
100             FINDER_CLASS_NAME_LIST, "countByFullImageId",
101             new String[] { Long.class.getName() });
102     public static final FinderPath FINDER_PATH_FETCH_BY_P_P = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
103             SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
104             FINDER_CLASS_NAME_ENTITY, "fetchByP_P",
105             new String[] { Long.class.getName(), Integer.class.getName() });
106     public static final FinderPath FINDER_PATH_COUNT_BY_P_P = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
107             SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
108             FINDER_CLASS_NAME_LIST, "countByP_P",
109             new String[] { Long.class.getName(), Integer.class.getName() });
110     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
111             SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
112             FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
113     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
114             SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
115             FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
116 
117     public void cacheResult(SCProductScreenshot scProductScreenshot) {
118         EntityCacheUtil.putResult(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
119             SCProductScreenshotImpl.class, scProductScreenshot.getPrimaryKey(),
120             scProductScreenshot);
121 
122         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
123             new Object[] { new Long(scProductScreenshot.getThumbnailId()) },
124             scProductScreenshot);
125 
126         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
127             new Object[] { new Long(scProductScreenshot.getFullImageId()) },
128             scProductScreenshot);
129 
130         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
131             new Object[] {
132                 new Long(scProductScreenshot.getProductEntryId()),
133                 new Integer(scProductScreenshot.getPriority())
134             }, scProductScreenshot);
135     }
136 
137     public void cacheResult(List<SCProductScreenshot> scProductScreenshots) {
138         for (SCProductScreenshot scProductScreenshot : scProductScreenshots) {
139             if (EntityCacheUtil.getResult(
140                         SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
141                         SCProductScreenshotImpl.class,
142                         scProductScreenshot.getPrimaryKey(), this) == null) {
143                 cacheResult(scProductScreenshot);
144             }
145         }
146     }
147 
148     public void clearCache() {
149         CacheRegistry.clear(SCProductScreenshotImpl.class.getName());
150         EntityCacheUtil.clearCache(SCProductScreenshotImpl.class.getName());
151         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
152         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
153     }
154 
155     public SCProductScreenshot create(long productScreenshotId) {
156         SCProductScreenshot scProductScreenshot = new SCProductScreenshotImpl();
157 
158         scProductScreenshot.setNew(true);
159         scProductScreenshot.setPrimaryKey(productScreenshotId);
160 
161         return scProductScreenshot;
162     }
163 
164     public SCProductScreenshot remove(Serializable primaryKey)
165         throws NoSuchModelException, SystemException {
166         return remove(((Long)primaryKey).longValue());
167     }
168 
169     public SCProductScreenshot remove(long productScreenshotId)
170         throws NoSuchProductScreenshotException, SystemException {
171         Session session = null;
172 
173         try {
174             session = openSession();
175 
176             SCProductScreenshot scProductScreenshot = (SCProductScreenshot)session.get(SCProductScreenshotImpl.class,
177                     new Long(productScreenshotId));
178 
179             if (scProductScreenshot == null) {
180                 if (_log.isWarnEnabled()) {
181                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
182                         productScreenshotId);
183                 }
184 
185                 throw new NoSuchProductScreenshotException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
186                     productScreenshotId);
187             }
188 
189             return remove(scProductScreenshot);
190         }
191         catch (NoSuchProductScreenshotException nsee) {
192             throw nsee;
193         }
194         catch (Exception e) {
195             throw processException(e);
196         }
197         finally {
198             closeSession(session);
199         }
200     }
201 
202     public SCProductScreenshot remove(SCProductScreenshot scProductScreenshot)
203         throws SystemException {
204         for (ModelListener<SCProductScreenshot> listener : listeners) {
205             listener.onBeforeRemove(scProductScreenshot);
206         }
207 
208         scProductScreenshot = removeImpl(scProductScreenshot);
209 
210         for (ModelListener<SCProductScreenshot> listener : listeners) {
211             listener.onAfterRemove(scProductScreenshot);
212         }
213 
214         return scProductScreenshot;
215     }
216 
217     protected SCProductScreenshot removeImpl(
218         SCProductScreenshot scProductScreenshot) throws SystemException {
219         scProductScreenshot = toUnwrappedModel(scProductScreenshot);
220 
221         Session session = null;
222 
223         try {
224             session = openSession();
225 
226             if (scProductScreenshot.isCachedModel() ||
227                     BatchSessionUtil.isEnabled()) {
228                 Object staleObject = session.get(SCProductScreenshotImpl.class,
229                         scProductScreenshot.getPrimaryKeyObj());
230 
231                 if (staleObject != null) {
232                     session.evict(staleObject);
233                 }
234             }
235 
236             session.delete(scProductScreenshot);
237 
238             session.flush();
239         }
240         catch (Exception e) {
241             throw processException(e);
242         }
243         finally {
244             closeSession(session);
245         }
246 
247         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
248 
249         SCProductScreenshotModelImpl scProductScreenshotModelImpl = (SCProductScreenshotModelImpl)scProductScreenshot;
250 
251         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
252             new Object[] {
253                 new Long(scProductScreenshotModelImpl.getOriginalThumbnailId())
254             });
255 
256         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
257             new Object[] {
258                 new Long(scProductScreenshotModelImpl.getOriginalFullImageId())
259             });
260 
261         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_P,
262             new Object[] {
263                 new Long(scProductScreenshotModelImpl.getOriginalProductEntryId()),
264                 new Integer(scProductScreenshotModelImpl.getOriginalPriority())
265             });
266 
267         EntityCacheUtil.removeResult(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
268             SCProductScreenshotImpl.class, scProductScreenshot.getPrimaryKey());
269 
270         return scProductScreenshot;
271     }
272 
273     public SCProductScreenshot updateImpl(
274         com.liferay.portlet.softwarecatalog.model.SCProductScreenshot scProductScreenshot,
275         boolean merge) throws SystemException {
276         scProductScreenshot = toUnwrappedModel(scProductScreenshot);
277 
278         boolean isNew = scProductScreenshot.isNew();
279 
280         SCProductScreenshotModelImpl scProductScreenshotModelImpl = (SCProductScreenshotModelImpl)scProductScreenshot;
281 
282         Session session = null;
283 
284         try {
285             session = openSession();
286 
287             BatchSessionUtil.update(session, scProductScreenshot, merge);
288 
289             scProductScreenshot.setNew(false);
290         }
291         catch (Exception e) {
292             throw processException(e);
293         }
294         finally {
295             closeSession(session);
296         }
297 
298         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
299 
300         EntityCacheUtil.putResult(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
301             SCProductScreenshotImpl.class, scProductScreenshot.getPrimaryKey(),
302             scProductScreenshot);
303 
304         if (!isNew &&
305                 (scProductScreenshot.getThumbnailId() != scProductScreenshotModelImpl.getOriginalThumbnailId())) {
306             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
307                 new Object[] {
308                     new Long(scProductScreenshotModelImpl.getOriginalThumbnailId())
309                 });
310         }
311 
312         if (isNew ||
313                 (scProductScreenshot.getThumbnailId() != scProductScreenshotModelImpl.getOriginalThumbnailId())) {
314             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
315                 new Object[] { new Long(scProductScreenshot.getThumbnailId()) },
316                 scProductScreenshot);
317         }
318 
319         if (!isNew &&
320                 (scProductScreenshot.getFullImageId() != scProductScreenshotModelImpl.getOriginalFullImageId())) {
321             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
322                 new Object[] {
323                     new Long(scProductScreenshotModelImpl.getOriginalFullImageId())
324                 });
325         }
326 
327         if (isNew ||
328                 (scProductScreenshot.getFullImageId() != scProductScreenshotModelImpl.getOriginalFullImageId())) {
329             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
330                 new Object[] { new Long(scProductScreenshot.getFullImageId()) },
331                 scProductScreenshot);
332         }
333 
334         if (!isNew &&
335                 ((scProductScreenshot.getProductEntryId() != scProductScreenshotModelImpl.getOriginalProductEntryId()) ||
336                 (scProductScreenshot.getPriority() != scProductScreenshotModelImpl.getOriginalPriority()))) {
337             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_P,
338                 new Object[] {
339                     new Long(scProductScreenshotModelImpl.getOriginalProductEntryId()),
340                     new Integer(scProductScreenshotModelImpl.getOriginalPriority())
341                 });
342         }
343 
344         if (isNew ||
345                 ((scProductScreenshot.getProductEntryId() != scProductScreenshotModelImpl.getOriginalProductEntryId()) ||
346                 (scProductScreenshot.getPriority() != scProductScreenshotModelImpl.getOriginalPriority()))) {
347             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
348                 new Object[] {
349                     new Long(scProductScreenshot.getProductEntryId()),
350                     new Integer(scProductScreenshot.getPriority())
351                 }, scProductScreenshot);
352         }
353 
354         return scProductScreenshot;
355     }
356 
357     protected SCProductScreenshot toUnwrappedModel(
358         SCProductScreenshot scProductScreenshot) {
359         if (scProductScreenshot instanceof SCProductScreenshotImpl) {
360             return scProductScreenshot;
361         }
362 
363         SCProductScreenshotImpl scProductScreenshotImpl = new SCProductScreenshotImpl();
364 
365         scProductScreenshotImpl.setNew(scProductScreenshot.isNew());
366         scProductScreenshotImpl.setPrimaryKey(scProductScreenshot.getPrimaryKey());
367 
368         scProductScreenshotImpl.setProductScreenshotId(scProductScreenshot.getProductScreenshotId());
369         scProductScreenshotImpl.setCompanyId(scProductScreenshot.getCompanyId());
370         scProductScreenshotImpl.setGroupId(scProductScreenshot.getGroupId());
371         scProductScreenshotImpl.setProductEntryId(scProductScreenshot.getProductEntryId());
372         scProductScreenshotImpl.setThumbnailId(scProductScreenshot.getThumbnailId());
373         scProductScreenshotImpl.setFullImageId(scProductScreenshot.getFullImageId());
374         scProductScreenshotImpl.setPriority(scProductScreenshot.getPriority());
375 
376         return scProductScreenshotImpl;
377     }
378 
379     public SCProductScreenshot findByPrimaryKey(Serializable primaryKey)
380         throws NoSuchModelException, SystemException {
381         return findByPrimaryKey(((Long)primaryKey).longValue());
382     }
383 
384     public SCProductScreenshot findByPrimaryKey(long productScreenshotId)
385         throws NoSuchProductScreenshotException, SystemException {
386         SCProductScreenshot scProductScreenshot = fetchByPrimaryKey(productScreenshotId);
387 
388         if (scProductScreenshot == null) {
389             if (_log.isWarnEnabled()) {
390                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
391                     productScreenshotId);
392             }
393 
394             throw new NoSuchProductScreenshotException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
395                 productScreenshotId);
396         }
397 
398         return scProductScreenshot;
399     }
400 
401     public SCProductScreenshot fetchByPrimaryKey(Serializable primaryKey)
402         throws SystemException {
403         return fetchByPrimaryKey(((Long)primaryKey).longValue());
404     }
405 
406     public SCProductScreenshot fetchByPrimaryKey(long productScreenshotId)
407         throws SystemException {
408         SCProductScreenshot scProductScreenshot = (SCProductScreenshot)EntityCacheUtil.getResult(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
409                 SCProductScreenshotImpl.class, productScreenshotId, this);
410 
411         if (scProductScreenshot == null) {
412             Session session = null;
413 
414             try {
415                 session = openSession();
416 
417                 scProductScreenshot = (SCProductScreenshot)session.get(SCProductScreenshotImpl.class,
418                         new Long(productScreenshotId));
419             }
420             catch (Exception e) {
421                 throw processException(e);
422             }
423             finally {
424                 if (scProductScreenshot != null) {
425                     cacheResult(scProductScreenshot);
426                 }
427 
428                 closeSession(session);
429             }
430         }
431 
432         return scProductScreenshot;
433     }
434 
435     public List<SCProductScreenshot> findByProductEntryId(long productEntryId)
436         throws SystemException {
437         Object[] finderArgs = new Object[] { new Long(productEntryId) };
438 
439         List<SCProductScreenshot> list = (List<SCProductScreenshot>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_PRODUCTENTRYID,
440                 finderArgs, this);
441 
442         if (list == null) {
443             Session session = null;
444 
445             try {
446                 session = openSession();
447 
448                 StringBundler query = new StringBundler(3);
449 
450                 query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
451 
452                 query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
453 
454                 query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
455 
456                 String sql = query.toString();
457 
458                 Query q = session.createQuery(sql);
459 
460                 QueryPos qPos = QueryPos.getInstance(q);
461 
462                 qPos.add(productEntryId);
463 
464                 list = q.list();
465             }
466             catch (Exception e) {
467                 throw processException(e);
468             }
469             finally {
470                 if (list == null) {
471                     list = new ArrayList<SCProductScreenshot>();
472                 }
473 
474                 cacheResult(list);
475 
476                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_PRODUCTENTRYID,
477                     finderArgs, list);
478 
479                 closeSession(session);
480             }
481         }
482 
483         return list;
484     }
485 
486     public List<SCProductScreenshot> findByProductEntryId(long productEntryId,
487         int start, int end) throws SystemException {
488         return findByProductEntryId(productEntryId, start, end, null);
489     }
490 
491     public List<SCProductScreenshot> findByProductEntryId(long productEntryId,
492         int start, int end, OrderByComparator obc) throws SystemException {
493         Object[] finderArgs = new Object[] {
494                 new Long(productEntryId),
495                 
496                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
497             };
498 
499         List<SCProductScreenshot> list = (List<SCProductScreenshot>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_PRODUCTENTRYID,
500                 finderArgs, this);
501 
502         if (list == null) {
503             Session session = null;
504 
505             try {
506                 session = openSession();
507 
508                 StringBundler query = null;
509 
510                 if (obc != null) {
511                     query = new StringBundler(3 +
512                             (obc.getOrderByFields().length * 3));
513                 }
514                 else {
515                     query = new StringBundler(3);
516                 }
517 
518                 query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
519 
520                 query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
521 
522                 if (obc != null) {
523                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
524                 }
525 
526                 else {
527                     query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
528                 }
529 
530                 String sql = query.toString();
531 
532                 Query q = session.createQuery(sql);
533 
534                 QueryPos qPos = QueryPos.getInstance(q);
535 
536                 qPos.add(productEntryId);
537 
538                 list = (List<SCProductScreenshot>)QueryUtil.list(q,
539                         getDialect(), start, end);
540             }
541             catch (Exception e) {
542                 throw processException(e);
543             }
544             finally {
545                 if (list == null) {
546                     list = new ArrayList<SCProductScreenshot>();
547                 }
548 
549                 cacheResult(list);
550 
551                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_PRODUCTENTRYID,
552                     finderArgs, list);
553 
554                 closeSession(session);
555             }
556         }
557 
558         return list;
559     }
560 
561     public SCProductScreenshot findByProductEntryId_First(long productEntryId,
562         OrderByComparator obc)
563         throws NoSuchProductScreenshotException, SystemException {
564         List<SCProductScreenshot> list = findByProductEntryId(productEntryId,
565                 0, 1, obc);
566 
567         if (list.isEmpty()) {
568             StringBundler msg = new StringBundler(4);
569 
570             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
571 
572             msg.append("productEntryId=");
573             msg.append(productEntryId);
574 
575             msg.append(StringPool.CLOSE_CURLY_BRACE);
576 
577             throw new NoSuchProductScreenshotException(msg.toString());
578         }
579         else {
580             return list.get(0);
581         }
582     }
583 
584     public SCProductScreenshot findByProductEntryId_Last(long productEntryId,
585         OrderByComparator obc)
586         throws NoSuchProductScreenshotException, SystemException {
587         int count = countByProductEntryId(productEntryId);
588 
589         List<SCProductScreenshot> list = findByProductEntryId(productEntryId,
590                 count - 1, count, obc);
591 
592         if (list.isEmpty()) {
593             StringBundler msg = new StringBundler(4);
594 
595             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
596 
597             msg.append("productEntryId=");
598             msg.append(productEntryId);
599 
600             msg.append(StringPool.CLOSE_CURLY_BRACE);
601 
602             throw new NoSuchProductScreenshotException(msg.toString());
603         }
604         else {
605             return list.get(0);
606         }
607     }
608 
609     public SCProductScreenshot[] findByProductEntryId_PrevAndNext(
610         long productScreenshotId, long productEntryId, OrderByComparator obc)
611         throws NoSuchProductScreenshotException, SystemException {
612         SCProductScreenshot scProductScreenshot = findByPrimaryKey(productScreenshotId);
613 
614         int count = countByProductEntryId(productEntryId);
615 
616         Session session = null;
617 
618         try {
619             session = openSession();
620 
621             StringBundler query = null;
622 
623             if (obc != null) {
624                 query = new StringBundler(3 +
625                         (obc.getOrderByFields().length * 3));
626             }
627             else {
628                 query = new StringBundler(3);
629             }
630 
631             query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
632 
633             query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
634 
635             if (obc != null) {
636                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
637             }
638 
639             else {
640                 query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
641             }
642 
643             String sql = query.toString();
644 
645             Query q = session.createQuery(sql);
646 
647             QueryPos qPos = QueryPos.getInstance(q);
648 
649             qPos.add(productEntryId);
650 
651             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
652                     scProductScreenshot);
653 
654             SCProductScreenshot[] array = new SCProductScreenshotImpl[3];
655 
656             array[0] = (SCProductScreenshot)objArray[0];
657             array[1] = (SCProductScreenshot)objArray[1];
658             array[2] = (SCProductScreenshot)objArray[2];
659 
660             return array;
661         }
662         catch (Exception e) {
663             throw processException(e);
664         }
665         finally {
666             closeSession(session);
667         }
668     }
669 
670     public SCProductScreenshot findByThumbnailId(long thumbnailId)
671         throws NoSuchProductScreenshotException, SystemException {
672         SCProductScreenshot scProductScreenshot = fetchByThumbnailId(thumbnailId);
673 
674         if (scProductScreenshot == null) {
675             StringBundler msg = new StringBundler(4);
676 
677             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
678 
679             msg.append("thumbnailId=");
680             msg.append(thumbnailId);
681 
682             msg.append(StringPool.CLOSE_CURLY_BRACE);
683 
684             if (_log.isWarnEnabled()) {
685                 _log.warn(msg.toString());
686             }
687 
688             throw new NoSuchProductScreenshotException(msg.toString());
689         }
690 
691         return scProductScreenshot;
692     }
693 
694     public SCProductScreenshot fetchByThumbnailId(long thumbnailId)
695         throws SystemException {
696         return fetchByThumbnailId(thumbnailId, true);
697     }
698 
699     public SCProductScreenshot fetchByThumbnailId(long thumbnailId,
700         boolean retrieveFromCache) throws SystemException {
701         Object[] finderArgs = new Object[] { new Long(thumbnailId) };
702 
703         Object result = null;
704 
705         if (retrieveFromCache) {
706             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
707                     finderArgs, this);
708         }
709 
710         if (result == null) {
711             Session session = null;
712 
713             try {
714                 session = openSession();
715 
716                 StringBundler query = new StringBundler(3);
717 
718                 query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
719 
720                 query.append(_FINDER_COLUMN_THUMBNAILID_THUMBNAILID_2);
721 
722                 query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
723 
724                 String sql = query.toString();
725 
726                 Query q = session.createQuery(sql);
727 
728                 QueryPos qPos = QueryPos.getInstance(q);
729 
730                 qPos.add(thumbnailId);
731 
732                 List<SCProductScreenshot> list = q.list();
733 
734                 result = list;
735 
736                 SCProductScreenshot scProductScreenshot = null;
737 
738                 if (list.isEmpty()) {
739                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
740                         finderArgs, list);
741                 }
742                 else {
743                     scProductScreenshot = list.get(0);
744 
745                     cacheResult(scProductScreenshot);
746 
747                     if ((scProductScreenshot.getThumbnailId() != thumbnailId)) {
748                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
749                             finderArgs, scProductScreenshot);
750                     }
751                 }
752 
753                 return scProductScreenshot;
754             }
755             catch (Exception e) {
756                 throw processException(e);
757             }
758             finally {
759                 if (result == null) {
760                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
761                         finderArgs, new ArrayList<SCProductScreenshot>());
762                 }
763 
764                 closeSession(session);
765             }
766         }
767         else {
768             if (result instanceof List<?>) {
769                 return null;
770             }
771             else {
772                 return (SCProductScreenshot)result;
773             }
774         }
775     }
776 
777     public SCProductScreenshot findByFullImageId(long fullImageId)
778         throws NoSuchProductScreenshotException, SystemException {
779         SCProductScreenshot scProductScreenshot = fetchByFullImageId(fullImageId);
780 
781         if (scProductScreenshot == null) {
782             StringBundler msg = new StringBundler(4);
783 
784             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
785 
786             msg.append("fullImageId=");
787             msg.append(fullImageId);
788 
789             msg.append(StringPool.CLOSE_CURLY_BRACE);
790 
791             if (_log.isWarnEnabled()) {
792                 _log.warn(msg.toString());
793             }
794 
795             throw new NoSuchProductScreenshotException(msg.toString());
796         }
797 
798         return scProductScreenshot;
799     }
800 
801     public SCProductScreenshot fetchByFullImageId(long fullImageId)
802         throws SystemException {
803         return fetchByFullImageId(fullImageId, true);
804     }
805 
806     public SCProductScreenshot fetchByFullImageId(long fullImageId,
807         boolean retrieveFromCache) throws SystemException {
808         Object[] finderArgs = new Object[] { new Long(fullImageId) };
809 
810         Object result = null;
811 
812         if (retrieveFromCache) {
813             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
814                     finderArgs, this);
815         }
816 
817         if (result == null) {
818             Session session = null;
819 
820             try {
821                 session = openSession();
822 
823                 StringBundler query = new StringBundler(3);
824 
825                 query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
826 
827                 query.append(_FINDER_COLUMN_FULLIMAGEID_FULLIMAGEID_2);
828 
829                 query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
830 
831                 String sql = query.toString();
832 
833                 Query q = session.createQuery(sql);
834 
835                 QueryPos qPos = QueryPos.getInstance(q);
836 
837                 qPos.add(fullImageId);
838 
839                 List<SCProductScreenshot> list = q.list();
840 
841                 result = list;
842 
843                 SCProductScreenshot scProductScreenshot = null;
844 
845                 if (list.isEmpty()) {
846                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
847                         finderArgs, list);
848                 }
849                 else {
850                     scProductScreenshot = list.get(0);
851 
852                     cacheResult(scProductScreenshot);
853 
854                     if ((scProductScreenshot.getFullImageId() != fullImageId)) {
855                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
856                             finderArgs, scProductScreenshot);
857                     }
858                 }
859 
860                 return scProductScreenshot;
861             }
862             catch (Exception e) {
863                 throw processException(e);
864             }
865             finally {
866                 if (result == null) {
867                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
868                         finderArgs, new ArrayList<SCProductScreenshot>());
869                 }
870 
871                 closeSession(session);
872             }
873         }
874         else {
875             if (result instanceof List<?>) {
876                 return null;
877             }
878             else {
879                 return (SCProductScreenshot)result;
880             }
881         }
882     }
883 
884     public SCProductScreenshot findByP_P(long productEntryId, int priority)
885         throws NoSuchProductScreenshotException, SystemException {
886         SCProductScreenshot scProductScreenshot = fetchByP_P(productEntryId,
887                 priority);
888 
889         if (scProductScreenshot == null) {
890             StringBundler msg = new StringBundler(6);
891 
892             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
893 
894             msg.append("productEntryId=");
895             msg.append(productEntryId);
896 
897             msg.append(", priority=");
898             msg.append(priority);
899 
900             msg.append(StringPool.CLOSE_CURLY_BRACE);
901 
902             if (_log.isWarnEnabled()) {
903                 _log.warn(msg.toString());
904             }
905 
906             throw new NoSuchProductScreenshotException(msg.toString());
907         }
908 
909         return scProductScreenshot;
910     }
911 
912     public SCProductScreenshot fetchByP_P(long productEntryId, int priority)
913         throws SystemException {
914         return fetchByP_P(productEntryId, priority, true);
915     }
916 
917     public SCProductScreenshot fetchByP_P(long productEntryId, int priority,
918         boolean retrieveFromCache) throws SystemException {
919         Object[] finderArgs = new Object[] {
920                 new Long(productEntryId), new Integer(priority)
921             };
922 
923         Object result = null;
924 
925         if (retrieveFromCache) {
926             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_P_P,
927                     finderArgs, this);
928         }
929 
930         if (result == null) {
931             Session session = null;
932 
933             try {
934                 session = openSession();
935 
936                 StringBundler query = new StringBundler(4);
937 
938                 query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
939 
940                 query.append(_FINDER_COLUMN_P_P_PRODUCTENTRYID_2);
941 
942                 query.append(_FINDER_COLUMN_P_P_PRIORITY_2);
943 
944                 query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
945 
946                 String sql = query.toString();
947 
948                 Query q = session.createQuery(sql);
949 
950                 QueryPos qPos = QueryPos.getInstance(q);
951 
952                 qPos.add(productEntryId);
953 
954                 qPos.add(priority);
955 
956                 List<SCProductScreenshot> list = q.list();
957 
958                 result = list;
959 
960                 SCProductScreenshot scProductScreenshot = null;
961 
962                 if (list.isEmpty()) {
963                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
964                         finderArgs, list);
965                 }
966                 else {
967                     scProductScreenshot = list.get(0);
968 
969                     cacheResult(scProductScreenshot);
970 
971                     if ((scProductScreenshot.getProductEntryId() != productEntryId) ||
972                             (scProductScreenshot.getPriority() != priority)) {
973                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
974                             finderArgs, scProductScreenshot);
975                     }
976                 }
977 
978                 return scProductScreenshot;
979             }
980             catch (Exception e) {
981                 throw processException(e);
982             }
983             finally {
984                 if (result == null) {
985                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
986                         finderArgs, new ArrayList<SCProductScreenshot>());
987                 }
988 
989                 closeSession(session);
990             }
991         }
992         else {
993             if (result instanceof List<?>) {
994                 return null;
995             }
996             else {
997                 return (SCProductScreenshot)result;
998             }
999         }
1000    }
1001
1002    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1003        throws SystemException {
1004        Session session = null;
1005
1006        try {
1007            session = openSession();
1008
1009            dynamicQuery.compile(session);
1010
1011            return dynamicQuery.list();
1012        }
1013        catch (Exception e) {
1014            throw processException(e);
1015        }
1016        finally {
1017            closeSession(session);
1018        }
1019    }
1020
1021    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1022        int start, int end) throws SystemException {
1023        Session session = null;
1024
1025        try {
1026            session = openSession();
1027
1028            dynamicQuery.setLimit(start, end);
1029
1030            dynamicQuery.compile(session);
1031
1032            return dynamicQuery.list();
1033        }
1034        catch (Exception e) {
1035            throw processException(e);
1036        }
1037        finally {
1038            closeSession(session);
1039        }
1040    }
1041
1042    public List<SCProductScreenshot> findAll() throws SystemException {
1043        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1044    }
1045
1046    public List<SCProductScreenshot> findAll(int start, int end)
1047        throws SystemException {
1048        return findAll(start, end, null);
1049    }
1050
1051    public List<SCProductScreenshot> findAll(int start, int end,
1052        OrderByComparator obc) throws SystemException {
1053        Object[] finderArgs = new Object[] {
1054                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1055            };
1056
1057        List<SCProductScreenshot> list = (List<SCProductScreenshot>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1058                finderArgs, this);
1059
1060        if (list == null) {
1061            Session session = null;
1062
1063            try {
1064                session = openSession();
1065
1066                StringBundler query = null;
1067                String sql = null;
1068
1069                if (obc != null) {
1070                    query = new StringBundler(2 +
1071                            (obc.getOrderByFields().length * 3));
1072
1073                    query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT);
1074
1075                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1076
1077                    sql = query.toString();
1078                }
1079
1080                else {
1081                    sql = _SQL_SELECT_SCPRODUCTSCREENSHOT.concat(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
1082                }
1083
1084                Query q = session.createQuery(sql);
1085
1086                if (obc == null) {
1087                    list = (List<SCProductScreenshot>)QueryUtil.list(q,
1088                            getDialect(), start, end, false);
1089
1090                    Collections.sort(list);
1091                }
1092                else {
1093                    list = (List<SCProductScreenshot>)QueryUtil.list(q,
1094                            getDialect(), start, end);
1095                }
1096            }
1097            catch (Exception e) {
1098                throw processException(e);
1099            }
1100            finally {
1101                if (list == null) {
1102                    list = new ArrayList<SCProductScreenshot>();
1103                }
1104
1105                cacheResult(list);
1106
1107                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1108
1109                closeSession(session);
1110            }
1111        }
1112
1113        return list;
1114    }
1115
1116    public void removeByProductEntryId(long productEntryId)
1117        throws SystemException {
1118        for (SCProductScreenshot scProductScreenshot : findByProductEntryId(
1119                productEntryId)) {
1120            remove(scProductScreenshot);
1121        }
1122    }
1123
1124    public void removeByThumbnailId(long thumbnailId)
1125        throws NoSuchProductScreenshotException, SystemException {
1126        SCProductScreenshot scProductScreenshot = findByThumbnailId(thumbnailId);
1127
1128        remove(scProductScreenshot);
1129    }
1130
1131    public void removeByFullImageId(long fullImageId)
1132        throws NoSuchProductScreenshotException, SystemException {
1133        SCProductScreenshot scProductScreenshot = findByFullImageId(fullImageId);
1134
1135        remove(scProductScreenshot);
1136    }
1137
1138    public void removeByP_P(long productEntryId, int priority)
1139        throws NoSuchProductScreenshotException, SystemException {
1140        SCProductScreenshot scProductScreenshot = findByP_P(productEntryId,
1141                priority);
1142
1143        remove(scProductScreenshot);
1144    }
1145
1146    public void removeAll() throws SystemException {
1147        for (SCProductScreenshot scProductScreenshot : findAll()) {
1148            remove(scProductScreenshot);
1149        }
1150    }
1151
1152    public int countByProductEntryId(long productEntryId)
1153        throws SystemException {
1154        Object[] finderArgs = new Object[] { new Long(productEntryId) };
1155
1156        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PRODUCTENTRYID,
1157                finderArgs, this);
1158
1159        if (count == null) {
1160            Session session = null;
1161
1162            try {
1163                session = openSession();
1164
1165                StringBundler query = new StringBundler(2);
1166
1167                query.append(_SQL_COUNT_SCPRODUCTSCREENSHOT_WHERE);
1168
1169                query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
1170
1171                String sql = query.toString();
1172
1173                Query q = session.createQuery(sql);
1174
1175                QueryPos qPos = QueryPos.getInstance(q);
1176
1177                qPos.add(productEntryId);
1178
1179                count = (Long)q.uniqueResult();
1180            }
1181            catch (Exception e) {
1182                throw processException(e);
1183            }
1184            finally {
1185                if (count == null) {
1186                    count = Long.valueOf(0);
1187                }
1188
1189                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PRODUCTENTRYID,
1190                    finderArgs, count);
1191
1192                closeSession(session);
1193            }
1194        }
1195
1196        return count.intValue();
1197    }
1198
1199    public int countByThumbnailId(long thumbnailId) throws SystemException {
1200        Object[] finderArgs = new Object[] { new Long(thumbnailId) };
1201
1202        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_THUMBNAILID,
1203                finderArgs, this);
1204
1205        if (count == null) {
1206            Session session = null;
1207
1208            try {
1209                session = openSession();
1210
1211                StringBundler query = new StringBundler(2);
1212
1213                query.append(_SQL_COUNT_SCPRODUCTSCREENSHOT_WHERE);
1214
1215                query.append(_FINDER_COLUMN_THUMBNAILID_THUMBNAILID_2);
1216
1217                String sql = query.toString();
1218
1219                Query q = session.createQuery(sql);
1220
1221                QueryPos qPos = QueryPos.getInstance(q);
1222
1223                qPos.add(thumbnailId);
1224
1225                count = (Long)q.uniqueResult();
1226            }
1227            catch (Exception e) {
1228                throw processException(e);
1229            }
1230            finally {
1231                if (count == null) {
1232                    count = Long.valueOf(0);
1233                }
1234
1235                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_THUMBNAILID,
1236                    finderArgs, count);
1237
1238                closeSession(session);
1239            }
1240        }
1241
1242        return count.intValue();
1243    }
1244
1245    public int countByFullImageId(long fullImageId) throws SystemException {
1246        Object[] finderArgs = new Object[] { new Long(fullImageId) };
1247
1248        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FULLIMAGEID,
1249                finderArgs, this);
1250
1251        if (count == null) {
1252            Session session = null;
1253
1254            try {
1255                session = openSession();
1256
1257                StringBundler query = new StringBundler(2);
1258
1259                query.append(_SQL_COUNT_SCPRODUCTSCREENSHOT_WHERE);
1260
1261                query.append(_FINDER_COLUMN_FULLIMAGEID_FULLIMAGEID_2);
1262
1263                String sql = query.toString();
1264
1265                Query q = session.createQuery(sql);
1266
1267                QueryPos qPos = QueryPos.getInstance(q);
1268
1269                qPos.add(fullImageId);
1270
1271                count = (Long)q.uniqueResult();
1272            }
1273            catch (Exception e) {
1274                throw processException(e);
1275            }
1276            finally {
1277                if (count == null) {
1278                    count = Long.valueOf(0);
1279                }
1280
1281                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FULLIMAGEID,
1282                    finderArgs, count);
1283
1284                closeSession(session);
1285            }
1286        }
1287
1288        return count.intValue();
1289    }
1290
1291    public int countByP_P(long productEntryId, int priority)
1292        throws SystemException {
1293        Object[] finderArgs = new Object[] {
1294                new Long(productEntryId), new Integer(priority)
1295            };
1296
1297        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_P,
1298                finderArgs, this);
1299
1300        if (count == null) {
1301            Session session = null;
1302
1303            try {
1304                session = openSession();
1305
1306                StringBundler query = new StringBundler(3);
1307
1308                query.append(_SQL_COUNT_SCPRODUCTSCREENSHOT_WHERE);
1309
1310                query.append(_FINDER_COLUMN_P_P_PRODUCTENTRYID_2);
1311
1312                query.append(_FINDER_COLUMN_P_P_PRIORITY_2);
1313
1314                String sql = query.toString();
1315
1316                Query q = session.createQuery(sql);
1317
1318                QueryPos qPos = QueryPos.getInstance(q);
1319
1320                qPos.add(productEntryId);
1321
1322                qPos.add(priority);
1323
1324                count = (Long)q.uniqueResult();
1325            }
1326            catch (Exception e) {
1327                throw processException(e);
1328            }
1329            finally {
1330                if (count == null) {
1331                    count = Long.valueOf(0);
1332                }
1333
1334                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_P, finderArgs,
1335                    count);
1336
1337                closeSession(session);
1338            }
1339        }
1340
1341        return count.intValue();
1342    }
1343
1344    public int countAll() throws SystemException {
1345        Object[] finderArgs = new Object[0];
1346
1347        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1348                finderArgs, this);
1349
1350        if (count == null) {
1351            Session session = null;
1352
1353            try {
1354                session = openSession();
1355
1356                Query q = session.createQuery(_SQL_COUNT_SCPRODUCTSCREENSHOT);
1357
1358                count = (Long)q.uniqueResult();
1359            }
1360            catch (Exception e) {
1361                throw processException(e);
1362            }
1363            finally {
1364                if (count == null) {
1365                    count = Long.valueOf(0);
1366                }
1367
1368                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1369                    count);
1370
1371                closeSession(session);
1372            }
1373        }
1374
1375        return count.intValue();
1376    }
1377
1378    public void afterPropertiesSet() {
1379        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1380                    com.liferay.portal.util.PropsUtil.get(
1381                        "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot")));
1382
1383        if (listenerClassNames.length > 0) {
1384            try {
1385                List<ModelListener<SCProductScreenshot>> listenersList = new ArrayList<ModelListener<SCProductScreenshot>>();
1386
1387                for (String listenerClassName : listenerClassNames) {
1388                    listenersList.add((ModelListener<SCProductScreenshot>)Class.forName(
1389                            listenerClassName).newInstance());
1390                }
1391
1392                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1393            }
1394            catch (Exception e) {
1395                _log.error(e);
1396            }
1397        }
1398    }
1399
1400    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCLicensePersistence")
1401    protected com.liferay.portlet.softwarecatalog.service.persistence.SCLicensePersistence scLicensePersistence;
1402    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCFrameworkVersionPersistence")
1403    protected com.liferay.portlet.softwarecatalog.service.persistence.SCFrameworkVersionPersistence scFrameworkVersionPersistence;
1404    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCProductEntryPersistence")
1405    protected com.liferay.portlet.softwarecatalog.service.persistence.SCProductEntryPersistence scProductEntryPersistence;
1406    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCProductScreenshotPersistence")
1407    protected com.liferay.portlet.softwarecatalog.service.persistence.SCProductScreenshotPersistence scProductScreenshotPersistence;
1408    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCProductVersionPersistence")
1409    protected com.liferay.portlet.softwarecatalog.service.persistence.SCProductVersionPersistence scProductVersionPersistence;
1410    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence")
1411    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
1412    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
1413    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
1414    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
1415    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
1416    private static final String _SQL_SELECT_SCPRODUCTSCREENSHOT = "SELECT scProductScreenshot FROM SCProductScreenshot scProductScreenshot";
1417    private static final String _SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE = "SELECT scProductScreenshot FROM SCProductScreenshot scProductScreenshot WHERE ";
1418    private static final String _SQL_COUNT_SCPRODUCTSCREENSHOT = "SELECT COUNT(scProductScreenshot) FROM SCProductScreenshot scProductScreenshot";
1419    private static final String _SQL_COUNT_SCPRODUCTSCREENSHOT_WHERE = "SELECT COUNT(scProductScreenshot) FROM SCProductScreenshot scProductScreenshot WHERE ";
1420    private static final String _FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2 = "scProductScreenshot.productEntryId = ?";
1421    private static final String _FINDER_COLUMN_THUMBNAILID_THUMBNAILID_2 = "scProductScreenshot.thumbnailId = ?";
1422    private static final String _FINDER_COLUMN_FULLIMAGEID_FULLIMAGEID_2 = "scProductScreenshot.fullImageId = ?";
1423    private static final String _FINDER_COLUMN_P_P_PRODUCTENTRYID_2 = "scProductScreenshot.productEntryId = ? AND ";
1424    private static final String _FINDER_COLUMN_P_P_PRIORITY_2 = "scProductScreenshot.priority = ?";
1425    private static final String _ORDER_BY_ENTITY_ALIAS = "scProductScreenshot.";
1426    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCProductScreenshot exists with the primary key ";
1427    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCProductScreenshot exists with the key {";
1428    private static Log _log = LogFactoryUtil.getLog(SCProductScreenshotPersistenceImpl.class);
1429}