1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.softwarecatalog.service.persistence;
24  
25  import com.liferay.portal.SystemException;
26  import com.liferay.portal.kernel.dao.DynamicQuery;
27  import com.liferay.portal.kernel.dao.DynamicQueryInitializer;
28  import com.liferay.portal.kernel.util.GetterUtil;
29  import com.liferay.portal.kernel.util.OrderByComparator;
30  import com.liferay.portal.kernel.util.StringMaker;
31  import com.liferay.portal.kernel.util.StringPool;
32  import com.liferay.portal.kernel.util.StringUtil;
33  import com.liferay.portal.model.ModelListener;
34  import com.liferay.portal.service.persistence.BasePersistence;
35  import com.liferay.portal.spring.hibernate.FinderCache;
36  import com.liferay.portal.spring.hibernate.HibernateUtil;
37  import com.liferay.portal.util.PropsUtil;
38  
39  import com.liferay.portlet.softwarecatalog.NoSuchProductVersionException;
40  import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
41  import com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionImpl;
42  import com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl;
43  
44  import com.liferay.util.dao.hibernate.QueryPos;
45  import com.liferay.util.dao.hibernate.QueryUtil;
46  
47  import org.apache.commons.logging.Log;
48  import org.apache.commons.logging.LogFactory;
49  
50  import org.hibernate.Hibernate;
51  import org.hibernate.Query;
52  import org.hibernate.SQLQuery;
53  import org.hibernate.Session;
54  
55  import org.springframework.dao.DataAccessException;
56  
57  import org.springframework.jdbc.core.SqlParameter;
58  import org.springframework.jdbc.object.MappingSqlQuery;
59  import org.springframework.jdbc.object.SqlUpdate;
60  
61  import java.sql.ResultSet;
62  import java.sql.SQLException;
63  import java.sql.Types;
64  
65  import java.util.ArrayList;
66  import java.util.Collections;
67  import java.util.Iterator;
68  import java.util.List;
69  
70  /**
71   * <a href="SCProductVersionPersistenceImpl.java.html"><b><i>View Source</i></b></a>
72   *
73   * @author Brian Wing Shun Chan
74   *
75   */
76  public class SCProductVersionPersistenceImpl extends BasePersistence
77      implements SCProductVersionPersistence {
78      public SCProductVersion create(long productVersionId) {
79          SCProductVersion scProductVersion = new SCProductVersionImpl();
80  
81          scProductVersion.setNew(true);
82          scProductVersion.setPrimaryKey(productVersionId);
83  
84          return scProductVersion;
85      }
86  
87      public SCProductVersion remove(long productVersionId)
88          throws NoSuchProductVersionException, SystemException {
89          Session session = null;
90  
91          try {
92              session = openSession();
93  
94              SCProductVersion scProductVersion = (SCProductVersion)session.get(SCProductVersionImpl.class,
95                      new Long(productVersionId));
96  
97              if (scProductVersion == null) {
98                  if (_log.isWarnEnabled()) {
99                      _log.warn(
100                         "No SCProductVersion exists with the primary key " +
101                         productVersionId);
102                 }
103 
104                 throw new NoSuchProductVersionException(
105                     "No SCProductVersion exists with the primary key " +
106                     productVersionId);
107             }
108 
109             return remove(scProductVersion);
110         }
111         catch (NoSuchProductVersionException nsee) {
112             throw nsee;
113         }
114         catch (Exception e) {
115             throw HibernateUtil.processException(e);
116         }
117         finally {
118             closeSession(session);
119         }
120     }
121 
122     public SCProductVersion remove(SCProductVersion scProductVersion)
123         throws SystemException {
124         if (_listeners != null) {
125             for (ModelListener listener : _listeners) {
126                 listener.onBeforeRemove(scProductVersion);
127             }
128         }
129 
130         scProductVersion = removeImpl(scProductVersion);
131 
132         if (_listeners != null) {
133             for (ModelListener listener : _listeners) {
134                 listener.onAfterRemove(scProductVersion);
135             }
136         }
137 
138         return scProductVersion;
139     }
140 
141     protected SCProductVersion removeImpl(SCProductVersion scProductVersion)
142         throws SystemException {
143         try {
144             clearSCFrameworkVersions.clear(scProductVersion.getPrimaryKey());
145         }
146         catch (Exception e) {
147             throw HibernateUtil.processException(e);
148         }
149         finally {
150             FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
151         }
152 
153         Session session = null;
154 
155         try {
156             session = openSession();
157 
158             session.delete(scProductVersion);
159 
160             session.flush();
161 
162             return scProductVersion;
163         }
164         catch (Exception e) {
165             throw HibernateUtil.processException(e);
166         }
167         finally {
168             closeSession(session);
169 
170             FinderCache.clearCache(SCProductVersion.class.getName());
171         }
172     }
173 
174     /**
175      * @deprecated Use <code>update(SCProductVersion scProductVersion, boolean merge)</code>.
176      */
177     public SCProductVersion update(SCProductVersion scProductVersion)
178         throws SystemException {
179         if (_log.isWarnEnabled()) {
180             _log.warn(
181                 "Using the deprecated update(SCProductVersion scProductVersion) method. Use update(SCProductVersion scProductVersion, boolean merge) instead.");
182         }
183 
184         return update(scProductVersion, false);
185     }
186 
187     /**
188      * Add, update, or merge, the entity. This method also calls the model
189      * listeners to trigger the proper events associated with adding, deleting,
190      * or updating an entity.
191      *
192      * @param        scProductVersion the entity to add, update, or merge
193      * @param        merge boolean value for whether to merge the entity. The
194      *                default value is false. Setting merge to true is more
195      *                expensive and should only be true when scProductVersion is
196      *                transient. See LEP-5473 for a detailed discussion of this
197      *                method.
198      * @return        true if the portlet can be displayed via Ajax
199      */
200     public SCProductVersion update(SCProductVersion scProductVersion,
201         boolean merge) throws SystemException {
202         boolean isNew = scProductVersion.isNew();
203 
204         if (_listeners != null) {
205             for (ModelListener listener : _listeners) {
206                 if (isNew) {
207                     listener.onBeforeCreate(scProductVersion);
208                 }
209                 else {
210                     listener.onBeforeUpdate(scProductVersion);
211                 }
212             }
213         }
214 
215         scProductVersion = updateImpl(scProductVersion, merge);
216 
217         if (_listeners != null) {
218             for (ModelListener listener : _listeners) {
219                 if (isNew) {
220                     listener.onAfterCreate(scProductVersion);
221                 }
222                 else {
223                     listener.onAfterUpdate(scProductVersion);
224                 }
225             }
226         }
227 
228         return scProductVersion;
229     }
230 
231     public SCProductVersion updateImpl(
232         com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion,
233         boolean merge) throws SystemException {
234         FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
235 
236         Session session = null;
237 
238         try {
239             session = openSession();
240 
241             if (merge) {
242                 session.merge(scProductVersion);
243             }
244             else {
245                 if (scProductVersion.isNew()) {
246                     session.save(scProductVersion);
247                 }
248             }
249 
250             session.flush();
251 
252             scProductVersion.setNew(false);
253 
254             return scProductVersion;
255         }
256         catch (Exception e) {
257             throw HibernateUtil.processException(e);
258         }
259         finally {
260             closeSession(session);
261 
262             FinderCache.clearCache(SCProductVersion.class.getName());
263         }
264     }
265 
266     public SCProductVersion findByPrimaryKey(long productVersionId)
267         throws NoSuchProductVersionException, SystemException {
268         SCProductVersion scProductVersion = fetchByPrimaryKey(productVersionId);
269 
270         if (scProductVersion == null) {
271             if (_log.isWarnEnabled()) {
272                 _log.warn("No SCProductVersion exists with the primary key " +
273                     productVersionId);
274             }
275 
276             throw new NoSuchProductVersionException(
277                 "No SCProductVersion exists with the primary key " +
278                 productVersionId);
279         }
280 
281         return scProductVersion;
282     }
283 
284     public SCProductVersion fetchByPrimaryKey(long productVersionId)
285         throws SystemException {
286         Session session = null;
287 
288         try {
289             session = openSession();
290 
291             return (SCProductVersion)session.get(SCProductVersionImpl.class,
292                 new Long(productVersionId));
293         }
294         catch (Exception e) {
295             throw HibernateUtil.processException(e);
296         }
297         finally {
298             closeSession(session);
299         }
300     }
301 
302     public List<SCProductVersion> findByProductEntryId(long productEntryId)
303         throws SystemException {
304         boolean finderClassNameCacheEnabled = SCProductVersionModelImpl.CACHE_ENABLED;
305         String finderClassName = SCProductVersion.class.getName();
306         String finderMethodName = "findByProductEntryId";
307         String[] finderParams = new String[] { Long.class.getName() };
308         Object[] finderArgs = new Object[] { new Long(productEntryId) };
309 
310         Object result = null;
311 
312         if (finderClassNameCacheEnabled) {
313             result = FinderCache.getResult(finderClassName, finderMethodName,
314                     finderParams, finderArgs, getSessionFactory());
315         }
316 
317         if (result == null) {
318             Session session = null;
319 
320             try {
321                 session = openSession();
322 
323                 StringMaker query = new StringMaker();
324 
325                 query.append(
326                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductVersion WHERE ");
327 
328                 query.append("productEntryId = ?");
329 
330                 query.append(" ");
331 
332                 query.append("ORDER BY ");
333 
334                 query.append("createDate DESC");
335 
336                 Query q = session.createQuery(query.toString());
337 
338                 int queryPos = 0;
339 
340                 q.setLong(queryPos++, productEntryId);
341 
342                 List<SCProductVersion> list = q.list();
343 
344                 FinderCache.putResult(finderClassNameCacheEnabled,
345                     finderClassName, finderMethodName, finderParams,
346                     finderArgs, list);
347 
348                 return list;
349             }
350             catch (Exception e) {
351                 throw HibernateUtil.processException(e);
352             }
353             finally {
354                 closeSession(session);
355             }
356         }
357         else {
358             return (List<SCProductVersion>)result;
359         }
360     }
361 
362     public List<SCProductVersion> findByProductEntryId(long productEntryId,
363         int begin, int end) throws SystemException {
364         return findByProductEntryId(productEntryId, begin, end, null);
365     }
366 
367     public List<SCProductVersion> findByProductEntryId(long productEntryId,
368         int begin, int end, OrderByComparator obc) throws SystemException {
369         boolean finderClassNameCacheEnabled = SCProductVersionModelImpl.CACHE_ENABLED;
370         String finderClassName = SCProductVersion.class.getName();
371         String finderMethodName = "findByProductEntryId";
372         String[] finderParams = new String[] {
373                 Long.class.getName(),
374                 
375                 "java.lang.Integer", "java.lang.Integer",
376                 "com.liferay.portal.kernel.util.OrderByComparator"
377             };
378         Object[] finderArgs = new Object[] {
379                 new Long(productEntryId),
380                 
381                 String.valueOf(begin), String.valueOf(end), String.valueOf(obc)
382             };
383 
384         Object result = null;
385 
386         if (finderClassNameCacheEnabled) {
387             result = FinderCache.getResult(finderClassName, finderMethodName,
388                     finderParams, finderArgs, getSessionFactory());
389         }
390 
391         if (result == null) {
392             Session session = null;
393 
394             try {
395                 session = openSession();
396 
397                 StringMaker query = new StringMaker();
398 
399                 query.append(
400                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductVersion WHERE ");
401 
402                 query.append("productEntryId = ?");
403 
404                 query.append(" ");
405 
406                 if (obc != null) {
407                     query.append("ORDER BY ");
408                     query.append(obc.getOrderBy());
409                 }
410 
411                 else {
412                     query.append("ORDER BY ");
413 
414                     query.append("createDate DESC");
415                 }
416 
417                 Query q = session.createQuery(query.toString());
418 
419                 int queryPos = 0;
420 
421                 q.setLong(queryPos++, productEntryId);
422 
423                 List<SCProductVersion> list = (List<SCProductVersion>)QueryUtil.list(q,
424                         getDialect(), begin, end);
425 
426                 FinderCache.putResult(finderClassNameCacheEnabled,
427                     finderClassName, finderMethodName, finderParams,
428                     finderArgs, list);
429 
430                 return list;
431             }
432             catch (Exception e) {
433                 throw HibernateUtil.processException(e);
434             }
435             finally {
436                 closeSession(session);
437             }
438         }
439         else {
440             return (List<SCProductVersion>)result;
441         }
442     }
443 
444     public SCProductVersion findByProductEntryId_First(long productEntryId,
445         OrderByComparator obc)
446         throws NoSuchProductVersionException, SystemException {
447         List<SCProductVersion> list = findByProductEntryId(productEntryId, 0,
448                 1, obc);
449 
450         if (list.size() == 0) {
451             StringMaker msg = new StringMaker();
452 
453             msg.append("No SCProductVersion exists with the key {");
454 
455             msg.append("productEntryId=" + productEntryId);
456 
457             msg.append(StringPool.CLOSE_CURLY_BRACE);
458 
459             throw new NoSuchProductVersionException(msg.toString());
460         }
461         else {
462             return list.get(0);
463         }
464     }
465 
466     public SCProductVersion findByProductEntryId_Last(long productEntryId,
467         OrderByComparator obc)
468         throws NoSuchProductVersionException, SystemException {
469         int count = countByProductEntryId(productEntryId);
470 
471         List<SCProductVersion> list = findByProductEntryId(productEntryId,
472                 count - 1, count, obc);
473 
474         if (list.size() == 0) {
475             StringMaker msg = new StringMaker();
476 
477             msg.append("No SCProductVersion exists with the key {");
478 
479             msg.append("productEntryId=" + productEntryId);
480 
481             msg.append(StringPool.CLOSE_CURLY_BRACE);
482 
483             throw new NoSuchProductVersionException(msg.toString());
484         }
485         else {
486             return list.get(0);
487         }
488     }
489 
490     public SCProductVersion[] findByProductEntryId_PrevAndNext(
491         long productVersionId, long productEntryId, OrderByComparator obc)
492         throws NoSuchProductVersionException, SystemException {
493         SCProductVersion scProductVersion = findByPrimaryKey(productVersionId);
494 
495         int count = countByProductEntryId(productEntryId);
496 
497         Session session = null;
498 
499         try {
500             session = openSession();
501 
502             StringMaker query = new StringMaker();
503 
504             query.append(
505                 "FROM com.liferay.portlet.softwarecatalog.model.SCProductVersion WHERE ");
506 
507             query.append("productEntryId = ?");
508 
509             query.append(" ");
510 
511             if (obc != null) {
512                 query.append("ORDER BY ");
513                 query.append(obc.getOrderBy());
514             }
515 
516             else {
517                 query.append("ORDER BY ");
518 
519                 query.append("createDate DESC");
520             }
521 
522             Query q = session.createQuery(query.toString());
523 
524             int queryPos = 0;
525 
526             q.setLong(queryPos++, productEntryId);
527 
528             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
529                     scProductVersion);
530 
531             SCProductVersion[] array = new SCProductVersionImpl[3];
532 
533             array[0] = (SCProductVersion)objArray[0];
534             array[1] = (SCProductVersion)objArray[1];
535             array[2] = (SCProductVersion)objArray[2];
536 
537             return array;
538         }
539         catch (Exception e) {
540             throw HibernateUtil.processException(e);
541         }
542         finally {
543             closeSession(session);
544         }
545     }
546 
547     public SCProductVersion findByDirectDownloadURL(String directDownloadURL)
548         throws NoSuchProductVersionException, SystemException {
549         SCProductVersion scProductVersion = fetchByDirectDownloadURL(directDownloadURL);
550 
551         if (scProductVersion == null) {
552             StringMaker msg = new StringMaker();
553 
554             msg.append("No SCProductVersion exists with the key {");
555 
556             msg.append("directDownloadURL=" + directDownloadURL);
557 
558             msg.append(StringPool.CLOSE_CURLY_BRACE);
559 
560             if (_log.isWarnEnabled()) {
561                 _log.warn(msg.toString());
562             }
563 
564             throw new NoSuchProductVersionException(msg.toString());
565         }
566 
567         return scProductVersion;
568     }
569 
570     public SCProductVersion fetchByDirectDownloadURL(String directDownloadURL)
571         throws SystemException {
572         boolean finderClassNameCacheEnabled = SCProductVersionModelImpl.CACHE_ENABLED;
573         String finderClassName = SCProductVersion.class.getName();
574         String finderMethodName = "fetchByDirectDownloadURL";
575         String[] finderParams = new String[] { String.class.getName() };
576         Object[] finderArgs = new Object[] { directDownloadURL };
577 
578         Object result = null;
579 
580         if (finderClassNameCacheEnabled) {
581             result = FinderCache.getResult(finderClassName, finderMethodName,
582                     finderParams, finderArgs, getSessionFactory());
583         }
584 
585         if (result == null) {
586             Session session = null;
587 
588             try {
589                 session = openSession();
590 
591                 StringMaker query = new StringMaker();
592 
593                 query.append(
594                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductVersion WHERE ");
595 
596                 if (directDownloadURL == null) {
597                     query.append("directDownloadURL IS NULL");
598                 }
599                 else {
600                     query.append("lower(directDownloadURL) = ?");
601                 }
602 
603                 query.append(" ");
604 
605                 query.append("ORDER BY ");
606 
607                 query.append("createDate DESC");
608 
609                 Query q = session.createQuery(query.toString());
610 
611                 int queryPos = 0;
612 
613                 if (directDownloadURL != null) {
614                     q.setString(queryPos++, directDownloadURL);
615                 }
616 
617                 List<SCProductVersion> list = q.list();
618 
619                 FinderCache.putResult(finderClassNameCacheEnabled,
620                     finderClassName, finderMethodName, finderParams,
621                     finderArgs, list);
622 
623                 if (list.size() == 0) {
624                     return null;
625                 }
626                 else {
627                     return list.get(0);
628                 }
629             }
630             catch (Exception e) {
631                 throw HibernateUtil.processException(e);
632             }
633             finally {
634                 closeSession(session);
635             }
636         }
637         else {
638             List<SCProductVersion> list = (List<SCProductVersion>)result;
639 
640             if (list.size() == 0) {
641                 return null;
642             }
643             else {
644                 return list.get(0);
645             }
646         }
647     }
648 
649     public List<SCProductVersion> findWithDynamicQuery(
650         DynamicQueryInitializer queryInitializer) throws SystemException {
651         Session session = null;
652 
653         try {
654             session = openSession();
655 
656             DynamicQuery query = queryInitializer.initialize(session);
657 
658             return query.list();
659         }
660         catch (Exception e) {
661             throw HibernateUtil.processException(e);
662         }
663         finally {
664             closeSession(session);
665         }
666     }
667 
668     public List<SCProductVersion> findWithDynamicQuery(
669         DynamicQueryInitializer queryInitializer, int begin, int end)
670         throws SystemException {
671         Session session = null;
672 
673         try {
674             session = openSession();
675 
676             DynamicQuery query = queryInitializer.initialize(session);
677 
678             query.setLimit(begin, end);
679 
680             return query.list();
681         }
682         catch (Exception e) {
683             throw HibernateUtil.processException(e);
684         }
685         finally {
686             closeSession(session);
687         }
688     }
689 
690     public List<SCProductVersion> findAll() throws SystemException {
691         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
692     }
693 
694     public List<SCProductVersion> findAll(int begin, int end)
695         throws SystemException {
696         return findAll(begin, end, null);
697     }
698 
699     public List<SCProductVersion> findAll(int begin, int end,
700         OrderByComparator obc) throws SystemException {
701         boolean finderClassNameCacheEnabled = SCProductVersionModelImpl.CACHE_ENABLED;
702         String finderClassName = SCProductVersion.class.getName();
703         String finderMethodName = "findAll";
704         String[] finderParams = new String[] {
705                 "java.lang.Integer", "java.lang.Integer",
706                 "com.liferay.portal.kernel.util.OrderByComparator"
707             };
708         Object[] finderArgs = new Object[] {
709                 String.valueOf(begin), String.valueOf(end), String.valueOf(obc)
710             };
711 
712         Object result = null;
713 
714         if (finderClassNameCacheEnabled) {
715             result = FinderCache.getResult(finderClassName, finderMethodName,
716                     finderParams, finderArgs, getSessionFactory());
717         }
718 
719         if (result == null) {
720             Session session = null;
721 
722             try {
723                 session = openSession();
724 
725                 StringMaker query = new StringMaker();
726 
727                 query.append(
728                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductVersion ");
729 
730                 if (obc != null) {
731                     query.append("ORDER BY ");
732                     query.append(obc.getOrderBy());
733                 }
734 
735                 else {
736                     query.append("ORDER BY ");
737 
738                     query.append("createDate DESC");
739                 }
740 
741                 Query q = session.createQuery(query.toString());
742 
743                 List<SCProductVersion> list = (List<SCProductVersion>)QueryUtil.list(q,
744                         getDialect(), begin, end);
745 
746                 if (obc == null) {
747                     Collections.sort(list);
748                 }
749 
750                 FinderCache.putResult(finderClassNameCacheEnabled,
751                     finderClassName, finderMethodName, finderParams,
752                     finderArgs, list);
753 
754                 return list;
755             }
756             catch (Exception e) {
757                 throw HibernateUtil.processException(e);
758             }
759             finally {
760                 closeSession(session);
761             }
762         }
763         else {
764             return (List<SCProductVersion>)result;
765         }
766     }
767 
768     public void removeByProductEntryId(long productEntryId)
769         throws SystemException {
770         for (SCProductVersion scProductVersion : findByProductEntryId(
771                 productEntryId)) {
772             remove(scProductVersion);
773         }
774     }
775 
776     public void removeByDirectDownloadURL(String directDownloadURL)
777         throws NoSuchProductVersionException, SystemException {
778         SCProductVersion scProductVersion = findByDirectDownloadURL(directDownloadURL);
779 
780         remove(scProductVersion);
781     }
782 
783     public void removeAll() throws SystemException {
784         for (SCProductVersion scProductVersion : findAll()) {
785             remove(scProductVersion);
786         }
787     }
788 
789     public int countByProductEntryId(long productEntryId)
790         throws SystemException {
791         boolean finderClassNameCacheEnabled = SCProductVersionModelImpl.CACHE_ENABLED;
792         String finderClassName = SCProductVersion.class.getName();
793         String finderMethodName = "countByProductEntryId";
794         String[] finderParams = new String[] { Long.class.getName() };
795         Object[] finderArgs = new Object[] { new Long(productEntryId) };
796 
797         Object result = null;
798 
799         if (finderClassNameCacheEnabled) {
800             result = FinderCache.getResult(finderClassName, finderMethodName,
801                     finderParams, finderArgs, getSessionFactory());
802         }
803 
804         if (result == null) {
805             Session session = null;
806 
807             try {
808                 session = openSession();
809 
810                 StringMaker query = new StringMaker();
811 
812                 query.append("SELECT COUNT(*) ");
813                 query.append(
814                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductVersion WHERE ");
815 
816                 query.append("productEntryId = ?");
817 
818                 query.append(" ");
819 
820                 Query q = session.createQuery(query.toString());
821 
822                 int queryPos = 0;
823 
824                 q.setLong(queryPos++, productEntryId);
825 
826                 Long count = null;
827 
828                 Iterator<Long> itr = q.list().iterator();
829 
830                 if (itr.hasNext()) {
831                     count = itr.next();
832                 }
833 
834                 if (count == null) {
835                     count = new Long(0);
836                 }
837 
838                 FinderCache.putResult(finderClassNameCacheEnabled,
839                     finderClassName, finderMethodName, finderParams,
840                     finderArgs, count);
841 
842                 return count.intValue();
843             }
844             catch (Exception e) {
845                 throw HibernateUtil.processException(e);
846             }
847             finally {
848                 closeSession(session);
849             }
850         }
851         else {
852             return ((Long)result).intValue();
853         }
854     }
855 
856     public int countByDirectDownloadURL(String directDownloadURL)
857         throws SystemException {
858         boolean finderClassNameCacheEnabled = SCProductVersionModelImpl.CACHE_ENABLED;
859         String finderClassName = SCProductVersion.class.getName();
860         String finderMethodName = "countByDirectDownloadURL";
861         String[] finderParams = new String[] { String.class.getName() };
862         Object[] finderArgs = new Object[] { directDownloadURL };
863 
864         Object result = null;
865 
866         if (finderClassNameCacheEnabled) {
867             result = FinderCache.getResult(finderClassName, finderMethodName,
868                     finderParams, finderArgs, getSessionFactory());
869         }
870 
871         if (result == null) {
872             Session session = null;
873 
874             try {
875                 session = openSession();
876 
877                 StringMaker query = new StringMaker();
878 
879                 query.append("SELECT COUNT(*) ");
880                 query.append(
881                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductVersion WHERE ");
882 
883                 if (directDownloadURL == null) {
884                     query.append("directDownloadURL IS NULL");
885                 }
886                 else {
887                     query.append("lower(directDownloadURL) = ?");
888                 }
889 
890                 query.append(" ");
891 
892                 Query q = session.createQuery(query.toString());
893 
894                 int queryPos = 0;
895 
896                 if (directDownloadURL != null) {
897                     q.setString(queryPos++, directDownloadURL);
898                 }
899 
900                 Long count = null;
901 
902                 Iterator<Long> itr = q.list().iterator();
903 
904                 if (itr.hasNext()) {
905                     count = itr.next();
906                 }
907 
908                 if (count == null) {
909                     count = new Long(0);
910                 }
911 
912                 FinderCache.putResult(finderClassNameCacheEnabled,
913                     finderClassName, finderMethodName, finderParams,
914                     finderArgs, count);
915 
916                 return count.intValue();
917             }
918             catch (Exception e) {
919                 throw HibernateUtil.processException(e);
920             }
921             finally {
922                 closeSession(session);
923             }
924         }
925         else {
926             return ((Long)result).intValue();
927         }
928     }
929 
930     public int countAll() throws SystemException {
931         boolean finderClassNameCacheEnabled = SCProductVersionModelImpl.CACHE_ENABLED;
932         String finderClassName = SCProductVersion.class.getName();
933         String finderMethodName = "countAll";
934         String[] finderParams = new String[] {  };
935         Object[] finderArgs = new Object[] {  };
936 
937         Object result = null;
938 
939         if (finderClassNameCacheEnabled) {
940             result = FinderCache.getResult(finderClassName, finderMethodName,
941                     finderParams, finderArgs, getSessionFactory());
942         }
943 
944         if (result == null) {
945             Session session = null;
946 
947             try {
948                 session = openSession();
949 
950                 Query q = session.createQuery(
951                         "SELECT COUNT(*) FROM com.liferay.portlet.softwarecatalog.model.SCProductVersion");
952 
953                 Long count = null;
954 
955                 Iterator<Long> itr = q.list().iterator();
956 
957                 if (itr.hasNext()) {
958                     count = itr.next();
959                 }
960 
961                 if (count == null) {
962                     count = new Long(0);
963                 }
964 
965                 FinderCache.putResult(finderClassNameCacheEnabled,
966                     finderClassName, finderMethodName, finderParams,
967                     finderArgs, count);
968 
969                 return count.intValue();
970             }
971             catch (Exception e) {
972                 throw HibernateUtil.processException(e);
973             }
974             finally {
975                 closeSession(session);
976             }
977         }
978         else {
979             return ((Long)result).intValue();
980         }
981     }
982 
983     public List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getSCFrameworkVersions(
984         long pk) throws NoSuchProductVersionException, SystemException {
985         return getSCFrameworkVersions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
986     }
987 
988     public List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getSCFrameworkVersions(
989         long pk, int begin, int end)
990         throws NoSuchProductVersionException, SystemException {
991         return getSCFrameworkVersions(pk, begin, end, null);
992     }
993 
994     public List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getSCFrameworkVersions(
995         long pk, int begin, int end, OrderByComparator obc)
996         throws NoSuchProductVersionException, SystemException {
997         boolean finderClassNameCacheEnabled = SCProductVersionModelImpl.CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS;
998 
999         String finderClassName = "SCFrameworkVersi_SCProductVers";
1000
1001        String finderMethodName = "getSCFrameworkVersions";
1002        String[] finderParams = new String[] {
1003                Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1004                "com.liferay.portal.kernel.util.OrderByComparator"
1005            };
1006        Object[] finderArgs = new Object[] {
1007                new Long(pk), String.valueOf(begin), String.valueOf(end),
1008                String.valueOf(obc)
1009            };
1010
1011        Object result = null;
1012
1013        if (finderClassNameCacheEnabled) {
1014            result = FinderCache.getResult(finderClassName, finderMethodName,
1015                    finderParams, finderArgs, getSessionFactory());
1016        }
1017
1018        if (result == null) {
1019            Session session = null;
1020
1021            try {
1022                session = HibernateUtil.openSession();
1023
1024                StringMaker sm = new StringMaker();
1025
1026                sm.append(_SQL_GETSCFRAMEWORKVERSIONS);
1027
1028                if (obc != null) {
1029                    sm.append("ORDER BY ");
1030                    sm.append(obc.getOrderBy());
1031                }
1032
1033                else {
1034                    sm.append("ORDER BY ");
1035
1036                    sm.append("SCFrameworkVersion.priority ASC, ");
1037                    sm.append("SCFrameworkVersion.name ASC");
1038                }
1039
1040                String sql = sm.toString();
1041
1042                SQLQuery q = session.createSQLQuery(sql);
1043
1044                q.addEntity("SCFrameworkVersion",
1045                    com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionImpl.class);
1046
1047                QueryPos qPos = QueryPos.getInstance(q);
1048
1049                qPos.add(pk);
1050
1051                List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> list =
1052                    (List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)QueryUtil.list(q,
1053                        getDialect(), begin, end);
1054
1055                FinderCache.putResult(finderClassNameCacheEnabled,
1056                    finderClassName, finderMethodName, finderParams,
1057                    finderArgs, list);
1058
1059                return list;
1060            }
1061            catch (Exception e) {
1062                throw new SystemException(e);
1063            }
1064            finally {
1065                closeSession(session);
1066            }
1067        }
1068        else {
1069            return (List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)result;
1070        }
1071    }
1072
1073    public int getSCFrameworkVersionsSize(long pk) throws SystemException {
1074        boolean finderClassNameCacheEnabled = SCProductVersionModelImpl.CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS;
1075
1076        String finderClassName = "SCFrameworkVersi_SCProductVers";
1077
1078        String finderMethodName = "getSCFrameworkVersionsSize";
1079        String[] finderParams = new String[] { Long.class.getName() };
1080        Object[] finderArgs = new Object[] { new Long(pk) };
1081
1082        Object result = null;
1083
1084        if (finderClassNameCacheEnabled) {
1085            result = FinderCache.getResult(finderClassName, finderMethodName,
1086                    finderParams, finderArgs, getSessionFactory());
1087        }
1088
1089        if (result == null) {
1090            Session session = null;
1091
1092            try {
1093                session = openSession();
1094
1095                SQLQuery q = session.createSQLQuery(_SQL_GETSCFRAMEWORKVERSIONSSIZE);
1096
1097                q.addScalar(HibernateUtil.getCountColumnName(), Hibernate.LONG);
1098
1099                QueryPos qPos = QueryPos.getInstance(q);
1100
1101                qPos.add(pk);
1102
1103                Long count = null;
1104
1105                Iterator<Long> itr = q.list().iterator();
1106
1107                if (itr.hasNext()) {
1108                    count = itr.next();
1109                }
1110
1111                if (count == null) {
1112                    count = new Long(0);
1113                }
1114
1115                FinderCache.putResult(finderClassNameCacheEnabled,
1116                    finderClassName, finderMethodName, finderParams,
1117                    finderArgs, count);
1118
1119                return count.intValue();
1120            }
1121            catch (Exception e) {
1122                throw HibernateUtil.processException(e);
1123            }
1124            finally {
1125                closeSession(session);
1126            }
1127        }
1128        else {
1129            return ((Long)result).intValue();
1130        }
1131    }
1132
1133    public boolean containsSCFrameworkVersion(long pk, long scFrameworkVersionPK)
1134        throws SystemException {
1135        boolean finderClassNameCacheEnabled = SCProductVersionModelImpl.CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS;
1136
1137        String finderClassName = "SCFrameworkVersi_SCProductVers";
1138
1139        String finderMethodName = "containsSCFrameworkVersions";
1140        String[] finderParams = new String[] {
1141                Long.class.getName(),
1142                
1143                Long.class.getName()
1144            };
1145        Object[] finderArgs = new Object[] {
1146                new Long(pk),
1147                
1148                new Long(scFrameworkVersionPK)
1149            };
1150
1151        Object result = null;
1152
1153        if (finderClassNameCacheEnabled) {
1154            result = FinderCache.getResult(finderClassName, finderMethodName,
1155                    finderParams, finderArgs, getSessionFactory());
1156        }
1157
1158        if (result == null) {
1159            try {
1160                Boolean value = Boolean.valueOf(containsSCFrameworkVersion.contains(
1161                            pk, scFrameworkVersionPK));
1162
1163                FinderCache.putResult(finderClassNameCacheEnabled,
1164                    finderClassName, finderMethodName, finderParams,
1165                    finderArgs, value);
1166
1167                return value.booleanValue();
1168            }
1169            catch (DataAccessException dae) {
1170                throw new SystemException(dae);
1171            }
1172        }
1173        else {
1174            return ((Boolean)result).booleanValue();
1175        }
1176    }
1177
1178    public boolean containsSCFrameworkVersions(long pk)
1179        throws SystemException {
1180        if (getSCFrameworkVersionsSize(pk) > 0) {
1181            return true;
1182        }
1183        else {
1184            return false;
1185        }
1186    }
1187
1188    public void addSCFrameworkVersion(long pk, long scFrameworkVersionPK)
1189        throws NoSuchProductVersionException,
1190            com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException,
1191            SystemException {
1192        try {
1193            addSCFrameworkVersion.add(pk, scFrameworkVersionPK);
1194        }
1195        catch (DataAccessException dae) {
1196            throw new SystemException(dae);
1197        }
1198        finally {
1199            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1200        }
1201    }
1202
1203    public void addSCFrameworkVersion(long pk,
1204        com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion)
1205        throws NoSuchProductVersionException,
1206            com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException,
1207            SystemException {
1208        try {
1209            addSCFrameworkVersion.add(pk, scFrameworkVersion.getPrimaryKey());
1210        }
1211        catch (DataAccessException dae) {
1212            throw new SystemException(dae);
1213        }
1214        finally {
1215            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1216        }
1217    }
1218
1219    public void addSCFrameworkVersions(long pk, long[] scFrameworkVersionPKs)
1220        throws NoSuchProductVersionException,
1221            com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException,
1222            SystemException {
1223        try {
1224            for (long scFrameworkVersionPK : scFrameworkVersionPKs) {
1225                addSCFrameworkVersion.add(pk, scFrameworkVersionPK);
1226            }
1227        }
1228        catch (DataAccessException dae) {
1229            throw new SystemException(dae);
1230        }
1231        finally {
1232            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1233        }
1234    }
1235
1236    public void addSCFrameworkVersions(long pk,
1237        List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions)
1238        throws NoSuchProductVersionException,
1239            com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException,
1240            SystemException {
1241        try {
1242            for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
1243                addSCFrameworkVersion.add(pk, scFrameworkVersion.getPrimaryKey());
1244            }
1245        }
1246        catch (DataAccessException dae) {
1247            throw new SystemException(dae);
1248        }
1249        finally {
1250            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1251        }
1252    }
1253
1254    public void clearSCFrameworkVersions(long pk)
1255        throws NoSuchProductVersionException, SystemException {
1256        try {
1257            clearSCFrameworkVersions.clear(pk);
1258        }
1259        catch (DataAccessException dae) {
1260            throw new SystemException(dae);
1261        }
1262        finally {
1263            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1264        }
1265    }
1266
1267    public void removeSCFrameworkVersion(long pk, long scFrameworkVersionPK)
1268        throws NoSuchProductVersionException,
1269            com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException,
1270            SystemException {
1271        try {
1272            removeSCFrameworkVersion.remove(pk, scFrameworkVersionPK);
1273        }
1274        catch (DataAccessException dae) {
1275            throw new SystemException(dae);
1276        }
1277        finally {
1278            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1279        }
1280    }
1281
1282    public void removeSCFrameworkVersion(long pk,
1283        com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion)
1284        throws NoSuchProductVersionException,
1285            com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException,
1286            SystemException {
1287        try {
1288            removeSCFrameworkVersion.remove(pk,
1289                scFrameworkVersion.getPrimaryKey());
1290        }
1291        catch (DataAccessException dae) {
1292            throw new SystemException(dae);
1293        }
1294        finally {
1295            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1296        }
1297    }
1298
1299    public void removeSCFrameworkVersions(long pk, long[] scFrameworkVersionPKs)
1300        throws NoSuchProductVersionException,
1301            com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException,
1302            SystemException {
1303        try {
1304            for (long scFrameworkVersionPK : scFrameworkVersionPKs) {
1305                removeSCFrameworkVersion.remove(pk, scFrameworkVersionPK);
1306            }
1307        }
1308        catch (DataAccessException dae) {
1309            throw new SystemException(dae);
1310        }
1311        finally {
1312            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1313        }
1314    }
1315
1316    public void removeSCFrameworkVersions(long pk,
1317        List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions)
1318        throws NoSuchProductVersionException,
1319            com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException,
1320            SystemException {
1321        try {
1322            for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
1323                removeSCFrameworkVersion.remove(pk,
1324                    scFrameworkVersion.getPrimaryKey());
1325            }
1326        }
1327        catch (DataAccessException dae) {
1328            throw new SystemException(dae);
1329        }
1330        finally {
1331            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1332        }
1333    }
1334
1335    public void setSCFrameworkVersions(long pk, long[] scFrameworkVersionPKs)
1336        throws NoSuchProductVersionException,
1337            com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException,
1338            SystemException {
1339        try {
1340            clearSCFrameworkVersions.clear(pk);
1341
1342            for (long scFrameworkVersionPK : scFrameworkVersionPKs) {
1343                addSCFrameworkVersion.add(pk, scFrameworkVersionPK);
1344            }
1345        }
1346        catch (DataAccessException dae) {
1347            throw new SystemException(dae);
1348        }
1349        finally {
1350            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1351        }
1352    }
1353
1354    public void setSCFrameworkVersions(long pk,
1355        List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions)
1356        throws NoSuchProductVersionException,
1357            com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException,
1358            SystemException {
1359        try {
1360            clearSCFrameworkVersions.clear(pk);
1361
1362            for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
1363                addSCFrameworkVersion.add(pk, scFrameworkVersion.getPrimaryKey());
1364            }
1365        }
1366        catch (DataAccessException dae) {
1367            throw new SystemException(dae);
1368        }
1369        finally {
1370            FinderCache.clearCache("SCFrameworkVersi_SCProductVers");
1371        }
1372    }
1373
1374    protected void initDao() {
1375        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1376                    PropsUtil.get(
1377                        "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductVersion")));
1378
1379        if (listenerClassNames.length > 0) {
1380            try {
1381                List<ModelListener> listeners = new ArrayList<ModelListener>();
1382
1383                for (String listenerClassName : listenerClassNames) {
1384                    listeners.add((ModelListener)Class.forName(
1385                            listenerClassName).newInstance());
1386                }
1387
1388                _listeners = listeners.toArray(new ModelListener[listeners.size()]);
1389            }
1390            catch (Exception e) {
1391                _log.error(e);
1392            }
1393        }
1394
1395        containsSCFrameworkVersion = new ContainsSCFrameworkVersion(this);
1396
1397        addSCFrameworkVersion = new AddSCFrameworkVersion(this);
1398        clearSCFrameworkVersions = new ClearSCFrameworkVersions(this);
1399        removeSCFrameworkVersion = new RemoveSCFrameworkVersion(this);
1400    }
1401
1402    protected ContainsSCFrameworkVersion containsSCFrameworkVersion;
1403    protected AddSCFrameworkVersion addSCFrameworkVersion;
1404    protected ClearSCFrameworkVersions clearSCFrameworkVersions;
1405    protected RemoveSCFrameworkVersion removeSCFrameworkVersion;
1406
1407    protected class ContainsSCFrameworkVersion extends MappingSqlQuery {
1408        protected ContainsSCFrameworkVersion(
1409            SCProductVersionPersistenceImpl persistenceImpl) {
1410            super(persistenceImpl.getDataSource(),
1411                _SQL_CONTAINSSCFRAMEWORKVERSION);
1412
1413            declareParameter(new SqlParameter(Types.BIGINT));
1414            declareParameter(new SqlParameter(Types.BIGINT));
1415
1416            compile();
1417        }
1418
1419        protected Object mapRow(ResultSet rs, int rowNumber)
1420            throws SQLException {
1421            return new Integer(rs.getInt("COUNT_VALUE"));
1422        }
1423
1424        protected boolean contains(long productVersionId,
1425            long frameworkVersionId) {
1426            List<Integer> results = execute(new Object[] {
1427                        new Long(productVersionId), new Long(frameworkVersionId)
1428                    });
1429
1430            if (results.size() > 0) {
1431                Integer count = results.get(0);
1432
1433                if (count.intValue() > 0) {
1434                    return true;
1435                }
1436            }
1437
1438            return false;
1439        }
1440    }
1441
1442    protected class AddSCFrameworkVersion extends SqlUpdate {
1443        protected AddSCFrameworkVersion(
1444            SCProductVersionPersistenceImpl persistenceImpl) {
1445            super(persistenceImpl.getDataSource(),
1446                "INSERT INTO SCFrameworkVersi_SCProductVers (productVersionId, frameworkVersionId) VALUES (?, ?)");
1447
1448            _persistenceImpl = persistenceImpl;
1449
1450            declareParameter(new SqlParameter(Types.BIGINT));
1451            declareParameter(new SqlParameter(Types.BIGINT));
1452
1453            compile();
1454        }
1455
1456        protected void add(long productVersionId, long frameworkVersionId) {
1457            if (!_persistenceImpl.containsSCFrameworkVersion.contains(
1458                        productVersionId, frameworkVersionId)) {
1459                update(new Object[] {
1460                        new Long(productVersionId), new Long(frameworkVersionId)
1461                    });
1462            }
1463        }
1464
1465        private SCProductVersionPersistenceImpl _persistenceImpl;
1466    }
1467
1468    protected class ClearSCFrameworkVersions extends SqlUpdate {
1469        protected ClearSCFrameworkVersions(
1470            SCProductVersionPersistenceImpl persistenceImpl) {
1471            super(persistenceImpl.getDataSource(),
1472                "DELETE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ?");
1473
1474            declareParameter(new SqlParameter(Types.BIGINT));
1475
1476            compile();
1477        }
1478
1479        protected void clear(long productVersionId) {
1480            update(new Object[] { new Long(productVersionId) });
1481        }
1482    }
1483
1484    protected class RemoveSCFrameworkVersion extends SqlUpdate {
1485        protected RemoveSCFrameworkVersion(
1486            SCProductVersionPersistenceImpl persistenceImpl) {
1487            super(persistenceImpl.getDataSource(),
1488                "DELETE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ? AND frameworkVersionId = ?");
1489
1490            declareParameter(new SqlParameter(Types.BIGINT));
1491            declareParameter(new SqlParameter(Types.BIGINT));
1492
1493            compile();
1494        }
1495
1496        protected void remove(long productVersionId, long frameworkVersionId) {
1497            update(new Object[] {
1498                    new Long(productVersionId), new Long(frameworkVersionId)
1499                });
1500        }
1501    }
1502
1503    private static final String _SQL_GETSCFRAMEWORKVERSIONS = "SELECT {SCFrameworkVersion.*} FROM SCFrameworkVersion INNER JOIN SCFrameworkVersi_SCProductVers ON (SCFrameworkVersi_SCProductVers.frameworkVersionId = SCFrameworkVersion.frameworkVersionId) WHERE (SCFrameworkVersi_SCProductVers.productVersionId = ?)";
1504    private static final String _SQL_GETSCFRAMEWORKVERSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ?";
1505    private static final String _SQL_CONTAINSSCFRAMEWORKVERSION = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ? AND frameworkVersionId = ?";
1506    private static Log _log = LogFactory.getLog(SCProductVersionPersistenceImpl.class);
1507    private ModelListener[] _listeners;
1508}