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.Validator;
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.NoSuchLicenseException;
40  import com.liferay.portlet.softwarecatalog.model.SCLicense;
41  import com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl;
42  import com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl;
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.Collections;
66  import java.util.Iterator;
67  import java.util.List;
68  
69  /**
70   * <a href="SCLicensePersistenceImpl.java.html"><b><i>View Source</i></b></a>
71   *
72   * @author Brian Wing Shun Chan
73   *
74   */
75  public class SCLicensePersistenceImpl extends BasePersistence
76      implements SCLicensePersistence {
77      public SCLicense create(long licenseId) {
78          SCLicense scLicense = new SCLicenseImpl();
79  
80          scLicense.setNew(true);
81          scLicense.setPrimaryKey(licenseId);
82  
83          return scLicense;
84      }
85  
86      public SCLicense remove(long licenseId)
87          throws NoSuchLicenseException, SystemException {
88          Session session = null;
89  
90          try {
91              session = openSession();
92  
93              SCLicense scLicense = (SCLicense)session.get(SCLicenseImpl.class,
94                      new Long(licenseId));
95  
96              if (scLicense == null) {
97                  if (_log.isWarnEnabled()) {
98                      _log.warn("No SCLicense exists with the primary key " +
99                          licenseId);
100                 }
101 
102                 throw new NoSuchLicenseException(
103                     "No SCLicense exists with the primary key " + licenseId);
104             }
105 
106             return remove(scLicense);
107         }
108         catch (NoSuchLicenseException nsee) {
109             throw nsee;
110         }
111         catch (Exception e) {
112             throw HibernateUtil.processException(e);
113         }
114         finally {
115             closeSession(session);
116         }
117     }
118 
119     public SCLicense remove(SCLicense scLicense) throws SystemException {
120         ModelListener listener = _getListener();
121 
122         if (listener != null) {
123             listener.onBeforeRemove(scLicense);
124         }
125 
126         scLicense = removeImpl(scLicense);
127 
128         if (listener != null) {
129             listener.onAfterRemove(scLicense);
130         }
131 
132         return scLicense;
133     }
134 
135     protected SCLicense removeImpl(SCLicense scLicense)
136         throws SystemException {
137         try {
138             clearSCProductEntries.clear(scLicense.getPrimaryKey());
139         }
140         catch (Exception e) {
141             throw HibernateUtil.processException(e);
142         }
143         finally {
144             FinderCache.clearCache("SCLicenses_SCProductEntries");
145         }
146 
147         Session session = null;
148 
149         try {
150             session = openSession();
151 
152             session.delete(scLicense);
153 
154             session.flush();
155 
156             return scLicense;
157         }
158         catch (Exception e) {
159             throw HibernateUtil.processException(e);
160         }
161         finally {
162             closeSession(session);
163 
164             FinderCache.clearCache(SCLicense.class.getName());
165         }
166     }
167 
168     public SCLicense update(SCLicense scLicense) throws SystemException {
169         return update(scLicense, false);
170     }
171 
172     public SCLicense update(SCLicense scLicense, boolean merge)
173         throws SystemException {
174         ModelListener listener = _getListener();
175 
176         boolean isNew = scLicense.isNew();
177 
178         if (listener != null) {
179             if (isNew) {
180                 listener.onBeforeCreate(scLicense);
181             }
182             else {
183                 listener.onBeforeUpdate(scLicense);
184             }
185         }
186 
187         scLicense = updateImpl(scLicense, merge);
188 
189         if (listener != null) {
190             if (isNew) {
191                 listener.onAfterCreate(scLicense);
192             }
193             else {
194                 listener.onAfterUpdate(scLicense);
195             }
196         }
197 
198         return scLicense;
199     }
200 
201     public SCLicense updateImpl(
202         com.liferay.portlet.softwarecatalog.model.SCLicense scLicense,
203         boolean merge) throws SystemException {
204         FinderCache.clearCache("SCLicenses_SCProductEntries");
205 
206         Session session = null;
207 
208         try {
209             session = openSession();
210 
211             if (merge) {
212                 session.merge(scLicense);
213             }
214             else {
215                 if (scLicense.isNew()) {
216                     session.save(scLicense);
217                 }
218             }
219 
220             session.flush();
221 
222             scLicense.setNew(false);
223 
224             return scLicense;
225         }
226         catch (Exception e) {
227             throw HibernateUtil.processException(e);
228         }
229         finally {
230             closeSession(session);
231 
232             FinderCache.clearCache(SCLicense.class.getName());
233         }
234     }
235 
236     public SCLicense findByPrimaryKey(long licenseId)
237         throws NoSuchLicenseException, SystemException {
238         SCLicense scLicense = fetchByPrimaryKey(licenseId);
239 
240         if (scLicense == null) {
241             if (_log.isWarnEnabled()) {
242                 _log.warn("No SCLicense exists with the primary key " +
243                     licenseId);
244             }
245 
246             throw new NoSuchLicenseException(
247                 "No SCLicense exists with the primary key " + licenseId);
248         }
249 
250         return scLicense;
251     }
252 
253     public SCLicense fetchByPrimaryKey(long licenseId)
254         throws SystemException {
255         Session session = null;
256 
257         try {
258             session = openSession();
259 
260             return (SCLicense)session.get(SCLicenseImpl.class,
261                 new Long(licenseId));
262         }
263         catch (Exception e) {
264             throw HibernateUtil.processException(e);
265         }
266         finally {
267             closeSession(session);
268         }
269     }
270 
271     public List findByActive(boolean active) throws SystemException {
272         boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED;
273         String finderClassName = SCLicense.class.getName();
274         String finderMethodName = "findByActive";
275         String[] finderParams = new String[] { Boolean.class.getName() };
276         Object[] finderArgs = new Object[] { Boolean.valueOf(active) };
277 
278         Object result = null;
279 
280         if (finderClassNameCacheEnabled) {
281             result = FinderCache.getResult(finderClassName, finderMethodName,
282                     finderParams, finderArgs, getSessionFactory());
283         }
284 
285         if (result == null) {
286             Session session = null;
287 
288             try {
289                 session = openSession();
290 
291                 StringMaker query = new StringMaker();
292 
293                 query.append(
294                     "FROM com.liferay.portlet.softwarecatalog.model.SCLicense WHERE ");
295 
296                 query.append("active_ = ?");
297 
298                 query.append(" ");
299 
300                 query.append("ORDER BY ");
301 
302                 query.append("name ASC");
303 
304                 Query q = session.createQuery(query.toString());
305 
306                 int queryPos = 0;
307 
308                 q.setBoolean(queryPos++, active);
309 
310                 List list = q.list();
311 
312                 FinderCache.putResult(finderClassNameCacheEnabled,
313                     finderClassName, finderMethodName, finderParams,
314                     finderArgs, list);
315 
316                 return list;
317             }
318             catch (Exception e) {
319                 throw HibernateUtil.processException(e);
320             }
321             finally {
322                 closeSession(session);
323             }
324         }
325         else {
326             return (List)result;
327         }
328     }
329 
330     public List findByActive(boolean active, int begin, int end)
331         throws SystemException {
332         return findByActive(active, begin, end, null);
333     }
334 
335     public List findByActive(boolean active, int begin, int end,
336         OrderByComparator obc) throws SystemException {
337         boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED;
338         String finderClassName = SCLicense.class.getName();
339         String finderMethodName = "findByActive";
340         String[] finderParams = new String[] {
341                 Boolean.class.getName(),
342                 
343                 "java.lang.Integer", "java.lang.Integer",
344                 "com.liferay.portal.kernel.util.OrderByComparator"
345             };
346         Object[] finderArgs = new Object[] {
347                 Boolean.valueOf(active),
348                 
349                 String.valueOf(begin), String.valueOf(end), String.valueOf(obc)
350             };
351 
352         Object result = null;
353 
354         if (finderClassNameCacheEnabled) {
355             result = FinderCache.getResult(finderClassName, finderMethodName,
356                     finderParams, finderArgs, getSessionFactory());
357         }
358 
359         if (result == null) {
360             Session session = null;
361 
362             try {
363                 session = openSession();
364 
365                 StringMaker query = new StringMaker();
366 
367                 query.append(
368                     "FROM com.liferay.portlet.softwarecatalog.model.SCLicense WHERE ");
369 
370                 query.append("active_ = ?");
371 
372                 query.append(" ");
373 
374                 if (obc != null) {
375                     query.append("ORDER BY ");
376                     query.append(obc.getOrderBy());
377                 }
378 
379                 else {
380                     query.append("ORDER BY ");
381 
382                     query.append("name ASC");
383                 }
384 
385                 Query q = session.createQuery(query.toString());
386 
387                 int queryPos = 0;
388 
389                 q.setBoolean(queryPos++, active);
390 
391                 List list = QueryUtil.list(q, getDialect(), begin, end);
392 
393                 FinderCache.putResult(finderClassNameCacheEnabled,
394                     finderClassName, finderMethodName, finderParams,
395                     finderArgs, list);
396 
397                 return list;
398             }
399             catch (Exception e) {
400                 throw HibernateUtil.processException(e);
401             }
402             finally {
403                 closeSession(session);
404             }
405         }
406         else {
407             return (List)result;
408         }
409     }
410 
411     public SCLicense findByActive_First(boolean active, OrderByComparator obc)
412         throws NoSuchLicenseException, SystemException {
413         List list = findByActive(active, 0, 1, obc);
414 
415         if (list.size() == 0) {
416             StringMaker msg = new StringMaker();
417 
418             msg.append("No SCLicense exists with the key {");
419 
420             msg.append("active=" + active);
421 
422             msg.append(StringPool.CLOSE_CURLY_BRACE);
423 
424             throw new NoSuchLicenseException(msg.toString());
425         }
426         else {
427             return (SCLicense)list.get(0);
428         }
429     }
430 
431     public SCLicense findByActive_Last(boolean active, OrderByComparator obc)
432         throws NoSuchLicenseException, SystemException {
433         int count = countByActive(active);
434 
435         List list = findByActive(active, count - 1, count, obc);
436 
437         if (list.size() == 0) {
438             StringMaker msg = new StringMaker();
439 
440             msg.append("No SCLicense exists with the key {");
441 
442             msg.append("active=" + active);
443 
444             msg.append(StringPool.CLOSE_CURLY_BRACE);
445 
446             throw new NoSuchLicenseException(msg.toString());
447         }
448         else {
449             return (SCLicense)list.get(0);
450         }
451     }
452 
453     public SCLicense[] findByActive_PrevAndNext(long licenseId, boolean active,
454         OrderByComparator obc) throws NoSuchLicenseException, SystemException {
455         SCLicense scLicense = findByPrimaryKey(licenseId);
456 
457         int count = countByActive(active);
458 
459         Session session = null;
460 
461         try {
462             session = openSession();
463 
464             StringMaker query = new StringMaker();
465 
466             query.append(
467                 "FROM com.liferay.portlet.softwarecatalog.model.SCLicense WHERE ");
468 
469             query.append("active_ = ?");
470 
471             query.append(" ");
472 
473             if (obc != null) {
474                 query.append("ORDER BY ");
475                 query.append(obc.getOrderBy());
476             }
477 
478             else {
479                 query.append("ORDER BY ");
480 
481                 query.append("name ASC");
482             }
483 
484             Query q = session.createQuery(query.toString());
485 
486             int queryPos = 0;
487 
488             q.setBoolean(queryPos++, active);
489 
490             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
491                     scLicense);
492 
493             SCLicense[] array = new SCLicenseImpl[3];
494 
495             array[0] = (SCLicense)objArray[0];
496             array[1] = (SCLicense)objArray[1];
497             array[2] = (SCLicense)objArray[2];
498 
499             return array;
500         }
501         catch (Exception e) {
502             throw HibernateUtil.processException(e);
503         }
504         finally {
505             closeSession(session);
506         }
507     }
508 
509     public List findByA_R(boolean active, boolean recommended)
510         throws SystemException {
511         boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED;
512         String finderClassName = SCLicense.class.getName();
513         String finderMethodName = "findByA_R";
514         String[] finderParams = new String[] {
515                 Boolean.class.getName(), Boolean.class.getName()
516             };
517         Object[] finderArgs = new Object[] {
518                 Boolean.valueOf(active), Boolean.valueOf(recommended)
519             };
520 
521         Object result = null;
522 
523         if (finderClassNameCacheEnabled) {
524             result = FinderCache.getResult(finderClassName, finderMethodName,
525                     finderParams, finderArgs, getSessionFactory());
526         }
527 
528         if (result == null) {
529             Session session = null;
530 
531             try {
532                 session = openSession();
533 
534                 StringMaker query = new StringMaker();
535 
536                 query.append(
537                     "FROM com.liferay.portlet.softwarecatalog.model.SCLicense WHERE ");
538 
539                 query.append("active_ = ?");
540 
541                 query.append(" AND ");
542 
543                 query.append("recommended = ?");
544 
545                 query.append(" ");
546 
547                 query.append("ORDER BY ");
548 
549                 query.append("name ASC");
550 
551                 Query q = session.createQuery(query.toString());
552 
553                 int queryPos = 0;
554 
555                 q.setBoolean(queryPos++, active);
556 
557                 q.setBoolean(queryPos++, recommended);
558 
559                 List list = q.list();
560 
561                 FinderCache.putResult(finderClassNameCacheEnabled,
562                     finderClassName, finderMethodName, finderParams,
563                     finderArgs, list);
564 
565                 return list;
566             }
567             catch (Exception e) {
568                 throw HibernateUtil.processException(e);
569             }
570             finally {
571                 closeSession(session);
572             }
573         }
574         else {
575             return (List)result;
576         }
577     }
578 
579     public List findByA_R(boolean active, boolean recommended, int begin,
580         int end) throws SystemException {
581         return findByA_R(active, recommended, begin, end, null);
582     }
583 
584     public List findByA_R(boolean active, boolean recommended, int begin,
585         int end, OrderByComparator obc) throws SystemException {
586         boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED;
587         String finderClassName = SCLicense.class.getName();
588         String finderMethodName = "findByA_R";
589         String[] finderParams = new String[] {
590                 Boolean.class.getName(), Boolean.class.getName(),
591                 
592                 "java.lang.Integer", "java.lang.Integer",
593                 "com.liferay.portal.kernel.util.OrderByComparator"
594             };
595         Object[] finderArgs = new Object[] {
596                 Boolean.valueOf(active), Boolean.valueOf(recommended),
597                 
598                 String.valueOf(begin), String.valueOf(end), String.valueOf(obc)
599             };
600 
601         Object result = null;
602 
603         if (finderClassNameCacheEnabled) {
604             result = FinderCache.getResult(finderClassName, finderMethodName,
605                     finderParams, finderArgs, getSessionFactory());
606         }
607 
608         if (result == null) {
609             Session session = null;
610 
611             try {
612                 session = openSession();
613 
614                 StringMaker query = new StringMaker();
615 
616                 query.append(
617                     "FROM com.liferay.portlet.softwarecatalog.model.SCLicense WHERE ");
618 
619                 query.append("active_ = ?");
620 
621                 query.append(" AND ");
622 
623                 query.append("recommended = ?");
624 
625                 query.append(" ");
626 
627                 if (obc != null) {
628                     query.append("ORDER BY ");
629                     query.append(obc.getOrderBy());
630                 }
631 
632                 else {
633                     query.append("ORDER BY ");
634 
635                     query.append("name ASC");
636                 }
637 
638                 Query q = session.createQuery(query.toString());
639 
640                 int queryPos = 0;
641 
642                 q.setBoolean(queryPos++, active);
643 
644                 q.setBoolean(queryPos++, recommended);
645 
646                 List list = QueryUtil.list(q, getDialect(), begin, end);
647 
648                 FinderCache.putResult(finderClassNameCacheEnabled,
649                     finderClassName, finderMethodName, finderParams,
650                     finderArgs, list);
651 
652                 return list;
653             }
654             catch (Exception e) {
655                 throw HibernateUtil.processException(e);
656             }
657             finally {
658                 closeSession(session);
659             }
660         }
661         else {
662             return (List)result;
663         }
664     }
665 
666     public SCLicense findByA_R_First(boolean active, boolean recommended,
667         OrderByComparator obc) throws NoSuchLicenseException, SystemException {
668         List list = findByA_R(active, recommended, 0, 1, obc);
669 
670         if (list.size() == 0) {
671             StringMaker msg = new StringMaker();
672 
673             msg.append("No SCLicense exists with the key {");
674 
675             msg.append("active=" + active);
676 
677             msg.append(", ");
678             msg.append("recommended=" + recommended);
679 
680             msg.append(StringPool.CLOSE_CURLY_BRACE);
681 
682             throw new NoSuchLicenseException(msg.toString());
683         }
684         else {
685             return (SCLicense)list.get(0);
686         }
687     }
688 
689     public SCLicense findByA_R_Last(boolean active, boolean recommended,
690         OrderByComparator obc) throws NoSuchLicenseException, SystemException {
691         int count = countByA_R(active, recommended);
692 
693         List list = findByA_R(active, recommended, count - 1, count, obc);
694 
695         if (list.size() == 0) {
696             StringMaker msg = new StringMaker();
697 
698             msg.append("No SCLicense exists with the key {");
699 
700             msg.append("active=" + active);
701 
702             msg.append(", ");
703             msg.append("recommended=" + recommended);
704 
705             msg.append(StringPool.CLOSE_CURLY_BRACE);
706 
707             throw new NoSuchLicenseException(msg.toString());
708         }
709         else {
710             return (SCLicense)list.get(0);
711         }
712     }
713 
714     public SCLicense[] findByA_R_PrevAndNext(long licenseId, boolean active,
715         boolean recommended, OrderByComparator obc)
716         throws NoSuchLicenseException, SystemException {
717         SCLicense scLicense = findByPrimaryKey(licenseId);
718 
719         int count = countByA_R(active, recommended);
720 
721         Session session = null;
722 
723         try {
724             session = openSession();
725 
726             StringMaker query = new StringMaker();
727 
728             query.append(
729                 "FROM com.liferay.portlet.softwarecatalog.model.SCLicense WHERE ");
730 
731             query.append("active_ = ?");
732 
733             query.append(" AND ");
734 
735             query.append("recommended = ?");
736 
737             query.append(" ");
738 
739             if (obc != null) {
740                 query.append("ORDER BY ");
741                 query.append(obc.getOrderBy());
742             }
743 
744             else {
745                 query.append("ORDER BY ");
746 
747                 query.append("name ASC");
748             }
749 
750             Query q = session.createQuery(query.toString());
751 
752             int queryPos = 0;
753 
754             q.setBoolean(queryPos++, active);
755 
756             q.setBoolean(queryPos++, recommended);
757 
758             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
759                     scLicense);
760 
761             SCLicense[] array = new SCLicenseImpl[3];
762 
763             array[0] = (SCLicense)objArray[0];
764             array[1] = (SCLicense)objArray[1];
765             array[2] = (SCLicense)objArray[2];
766 
767             return array;
768         }
769         catch (Exception e) {
770             throw HibernateUtil.processException(e);
771         }
772         finally {
773             closeSession(session);
774         }
775     }
776 
777     public List findWithDynamicQuery(DynamicQueryInitializer queryInitializer)
778         throws SystemException {
779         Session session = null;
780 
781         try {
782             session = openSession();
783 
784             DynamicQuery query = queryInitializer.initialize(session);
785 
786             return query.list();
787         }
788         catch (Exception e) {
789             throw HibernateUtil.processException(e);
790         }
791         finally {
792             closeSession(session);
793         }
794     }
795 
796     public List findWithDynamicQuery(DynamicQueryInitializer queryInitializer,
797         int begin, int end) throws SystemException {
798         Session session = null;
799 
800         try {
801             session = openSession();
802 
803             DynamicQuery query = queryInitializer.initialize(session);
804 
805             query.setLimit(begin, end);
806 
807             return query.list();
808         }
809         catch (Exception e) {
810             throw HibernateUtil.processException(e);
811         }
812         finally {
813             closeSession(session);
814         }
815     }
816 
817     public List findAll() throws SystemException {
818         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
819     }
820 
821     public List findAll(int begin, int end) throws SystemException {
822         return findAll(begin, end, null);
823     }
824 
825     public List findAll(int begin, int end, OrderByComparator obc)
826         throws SystemException {
827         boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED;
828         String finderClassName = SCLicense.class.getName();
829         String finderMethodName = "findAll";
830         String[] finderParams = new String[] {
831                 "java.lang.Integer", "java.lang.Integer",
832                 "com.liferay.portal.kernel.util.OrderByComparator"
833             };
834         Object[] finderArgs = new Object[] {
835                 String.valueOf(begin), String.valueOf(end), String.valueOf(obc)
836             };
837 
838         Object result = null;
839 
840         if (finderClassNameCacheEnabled) {
841             result = FinderCache.getResult(finderClassName, finderMethodName,
842                     finderParams, finderArgs, getSessionFactory());
843         }
844 
845         if (result == null) {
846             Session session = null;
847 
848             try {
849                 session = openSession();
850 
851                 StringMaker query = new StringMaker();
852 
853                 query.append(
854                     "FROM com.liferay.portlet.softwarecatalog.model.SCLicense ");
855 
856                 if (obc != null) {
857                     query.append("ORDER BY ");
858                     query.append(obc.getOrderBy());
859                 }
860 
861                 else {
862                     query.append("ORDER BY ");
863 
864                     query.append("name ASC");
865                 }
866 
867                 Query q = session.createQuery(query.toString());
868 
869                 List list = QueryUtil.list(q, getDialect(), begin, end);
870 
871                 if (obc == null) {
872                     Collections.sort(list);
873                 }
874 
875                 FinderCache.putResult(finderClassNameCacheEnabled,
876                     finderClassName, finderMethodName, finderParams,
877                     finderArgs, list);
878 
879                 return list;
880             }
881             catch (Exception e) {
882                 throw HibernateUtil.processException(e);
883             }
884             finally {
885                 closeSession(session);
886             }
887         }
888         else {
889             return (List)result;
890         }
891     }
892 
893     public void removeByActive(boolean active) throws SystemException {
894         Iterator itr = findByActive(active).iterator();
895 
896         while (itr.hasNext()) {
897             SCLicense scLicense = (SCLicense)itr.next();
898 
899             remove(scLicense);
900         }
901     }
902 
903     public void removeByA_R(boolean active, boolean recommended)
904         throws SystemException {
905         Iterator itr = findByA_R(active, recommended).iterator();
906 
907         while (itr.hasNext()) {
908             SCLicense scLicense = (SCLicense)itr.next();
909 
910             remove(scLicense);
911         }
912     }
913 
914     public void removeAll() throws SystemException {
915         Iterator itr = findAll().iterator();
916 
917         while (itr.hasNext()) {
918             remove((SCLicense)itr.next());
919         }
920     }
921 
922     public int countByActive(boolean active) throws SystemException {
923         boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED;
924         String finderClassName = SCLicense.class.getName();
925         String finderMethodName = "countByActive";
926         String[] finderParams = new String[] { Boolean.class.getName() };
927         Object[] finderArgs = new Object[] { Boolean.valueOf(active) };
928 
929         Object result = null;
930 
931         if (finderClassNameCacheEnabled) {
932             result = FinderCache.getResult(finderClassName, finderMethodName,
933                     finderParams, finderArgs, getSessionFactory());
934         }
935 
936         if (result == null) {
937             Session session = null;
938 
939             try {
940                 session = openSession();
941 
942                 StringMaker query = new StringMaker();
943 
944                 query.append("SELECT COUNT(*) ");
945                 query.append(
946                     "FROM com.liferay.portlet.softwarecatalog.model.SCLicense WHERE ");
947 
948                 query.append("active_ = ?");
949 
950                 query.append(" ");
951 
952                 Query q = session.createQuery(query.toString());
953 
954                 int queryPos = 0;
955 
956                 q.setBoolean(queryPos++, active);
957 
958                 Long count = null;
959 
960                 Iterator itr = q.list().iterator();
961 
962                 if (itr.hasNext()) {
963                     count = (Long)itr.next();
964                 }
965 
966                 if (count == null) {
967                     count = new Long(0);
968                 }
969 
970                 FinderCache.putResult(finderClassNameCacheEnabled,
971                     finderClassName, finderMethodName, finderParams,
972                     finderArgs, count);
973 
974                 return count.intValue();
975             }
976             catch (Exception e) {
977                 throw HibernateUtil.processException(e);
978             }
979             finally {
980                 closeSession(session);
981             }
982         }
983         else {
984             return ((Long)result).intValue();
985         }
986     }
987 
988     public int countByA_R(boolean active, boolean recommended)
989         throws SystemException {
990         boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED;
991         String finderClassName = SCLicense.class.getName();
992         String finderMethodName = "countByA_R";
993         String[] finderParams = new String[] {
994                 Boolean.class.getName(), Boolean.class.getName()
995             };
996         Object[] finderArgs = new Object[] {
997                 Boolean.valueOf(active), Boolean.valueOf(recommended)
998             };
999 
1000        Object result = null;
1001
1002        if (finderClassNameCacheEnabled) {
1003            result = FinderCache.getResult(finderClassName, finderMethodName,
1004                    finderParams, finderArgs, getSessionFactory());
1005        }
1006
1007        if (result == null) {
1008            Session session = null;
1009
1010            try {
1011                session = openSession();
1012
1013                StringMaker query = new StringMaker();
1014
1015                query.append("SELECT COUNT(*) ");
1016                query.append(
1017                    "FROM com.liferay.portlet.softwarecatalog.model.SCLicense WHERE ");
1018
1019                query.append("active_ = ?");
1020
1021                query.append(" AND ");
1022
1023                query.append("recommended = ?");
1024
1025                query.append(" ");
1026
1027                Query q = session.createQuery(query.toString());
1028
1029                int queryPos = 0;
1030
1031                q.setBoolean(queryPos++, active);
1032
1033                q.setBoolean(queryPos++, recommended);
1034
1035                Long count = null;
1036
1037                Iterator itr = q.list().iterator();
1038
1039                if (itr.hasNext()) {
1040                    count = (Long)itr.next();
1041                }
1042
1043                if (count == null) {
1044                    count = new Long(0);
1045                }
1046
1047                FinderCache.putResult(finderClassNameCacheEnabled,
1048                    finderClassName, finderMethodName, finderParams,
1049                    finderArgs, count);
1050
1051                return count.intValue();
1052            }
1053            catch (Exception e) {
1054                throw HibernateUtil.processException(e);
1055            }
1056            finally {
1057                closeSession(session);
1058            }
1059        }
1060        else {
1061            return ((Long)result).intValue();
1062        }
1063    }
1064
1065    public int countAll() throws SystemException {
1066        boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED;
1067        String finderClassName = SCLicense.class.getName();
1068        String finderMethodName = "countAll";
1069        String[] finderParams = new String[] {  };
1070        Object[] finderArgs = new Object[] {  };
1071
1072        Object result = null;
1073
1074        if (finderClassNameCacheEnabled) {
1075            result = FinderCache.getResult(finderClassName, finderMethodName,
1076                    finderParams, finderArgs, getSessionFactory());
1077        }
1078
1079        if (result == null) {
1080            Session session = null;
1081
1082            try {
1083                session = openSession();
1084
1085                Query q = session.createQuery(
1086                        "SELECT COUNT(*) FROM com.liferay.portlet.softwarecatalog.model.SCLicense");
1087
1088                Long count = null;
1089
1090                Iterator itr = q.list().iterator();
1091
1092                if (itr.hasNext()) {
1093                    count = (Long)itr.next();
1094                }
1095
1096                if (count == null) {
1097                    count = new Long(0);
1098                }
1099
1100                FinderCache.putResult(finderClassNameCacheEnabled,
1101                    finderClassName, finderMethodName, finderParams,
1102                    finderArgs, count);
1103
1104                return count.intValue();
1105            }
1106            catch (Exception e) {
1107                throw HibernateUtil.processException(e);
1108            }
1109            finally {
1110                closeSession(session);
1111            }
1112        }
1113        else {
1114            return ((Long)result).intValue();
1115        }
1116    }
1117
1118    public List getSCProductEntries(long pk)
1119        throws NoSuchLicenseException, SystemException {
1120        return getSCProductEntries(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1121    }
1122
1123    public List getSCProductEntries(long pk, int begin, int end)
1124        throws NoSuchLicenseException, SystemException {
1125        return getSCProductEntries(pk, begin, end, null);
1126    }
1127
1128    public List getSCProductEntries(long pk, int begin, int end,
1129        OrderByComparator obc) throws NoSuchLicenseException, SystemException {
1130        boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES;
1131        String finderClassName = "SCLicenses_SCProductEntries";
1132        String finderMethodName = "getSCProductEntries";
1133        String[] finderParams = new String[] {
1134                Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1135                "com.liferay.portal.kernel.util.OrderByComparator"
1136            };
1137        Object[] finderArgs = new Object[] {
1138                new Long(pk), String.valueOf(begin), String.valueOf(end),
1139                String.valueOf(obc)
1140            };
1141
1142        Object result = null;
1143
1144        if (finderClassNameCacheEnabled) {
1145            result = FinderCache.getResult(finderClassName, finderMethodName,
1146                    finderParams, finderArgs, getSessionFactory());
1147        }
1148
1149        if (result == null) {
1150            Session session = null;
1151
1152            try {
1153                session = HibernateUtil.openSession();
1154
1155                StringMaker sm = new StringMaker();
1156
1157                sm.append(_SQL_GETSCPRODUCTENTRIES);
1158
1159                if (obc != null) {
1160                    sm.append("ORDER BY ");
1161                    sm.append(obc.getOrderBy());
1162                }
1163
1164                else {
1165                    sm.append("ORDER BY ");
1166
1167                    sm.append("SCProductEntry.modifiedDate DESC, ");
1168                    sm.append("SCProductEntry.name DESC");
1169                }
1170
1171                String sql = sm.toString();
1172
1173                SQLQuery q = session.createSQLQuery(sql);
1174
1175                q.addEntity("SCProductEntry",
1176                    com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryImpl.class);
1177
1178                QueryPos qPos = QueryPos.getInstance(q);
1179
1180                qPos.add(pk);
1181
1182                List list = QueryUtil.list(q, getDialect(), begin, end);
1183
1184                FinderCache.putResult(finderClassNameCacheEnabled,
1185                    finderClassName, finderMethodName, finderParams,
1186                    finderArgs, list);
1187
1188                return list;
1189            }
1190            catch (Exception e) {
1191                throw new SystemException(e);
1192            }
1193            finally {
1194                closeSession(session);
1195            }
1196        }
1197        else {
1198            return (List)result;
1199        }
1200    }
1201
1202    public int getSCProductEntriesSize(long pk) throws SystemException {
1203        boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES;
1204        String finderClassName = "SCLicenses_SCProductEntries";
1205        String finderMethodName = "getSCProductEntriesSize";
1206        String[] finderParams = new String[] { Long.class.getName() };
1207        Object[] finderArgs = new Object[] { new Long(pk) };
1208
1209        Object result = null;
1210
1211        if (finderClassNameCacheEnabled) {
1212            result = FinderCache.getResult(finderClassName, finderMethodName,
1213                    finderParams, finderArgs, getSessionFactory());
1214        }
1215
1216        if (result == null) {
1217            Session session = null;
1218
1219            try {
1220                session = openSession();
1221
1222                SQLQuery q = session.createSQLQuery(_SQL_GETSCPRODUCTENTRIESSIZE);
1223
1224                q.addScalar(HibernateUtil.getCountColumnName(), Hibernate.LONG);
1225
1226                QueryPos qPos = QueryPos.getInstance(q);
1227
1228                qPos.add(pk);
1229
1230                Long count = null;
1231
1232                Iterator itr = q.list().iterator();
1233
1234                if (itr.hasNext()) {
1235                    count = (Long)itr.next();
1236                }
1237
1238                if (count == null) {
1239                    count = new Long(0);
1240                }
1241
1242                FinderCache.putResult(finderClassNameCacheEnabled,
1243                    finderClassName, finderMethodName, finderParams,
1244                    finderArgs, count);
1245
1246                return count.intValue();
1247            }
1248            catch (Exception e) {
1249                throw HibernateUtil.processException(e);
1250            }
1251            finally {
1252                closeSession(session);
1253            }
1254        }
1255        else {
1256            return ((Long)result).intValue();
1257        }
1258    }
1259
1260    public boolean containsSCProductEntry(long pk, long scProductEntryPK)
1261        throws SystemException {
1262        boolean finderClassNameCacheEnabled = SCLicenseModelImpl.CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES;
1263        String finderClassName = "SCLicenses_SCProductEntries";
1264        String finderMethodName = "containsSCProductEntries";
1265        String[] finderParams = new String[] {
1266                Long.class.getName(),
1267                
1268                Long.class.getName()
1269            };
1270        Object[] finderArgs = new Object[] {
1271                new Long(pk),
1272                
1273                new Long(scProductEntryPK)
1274            };
1275
1276        Object result = null;
1277
1278        if (finderClassNameCacheEnabled) {
1279            result = FinderCache.getResult(finderClassName, finderMethodName,
1280                    finderParams, finderArgs, getSessionFactory());
1281        }
1282
1283        if (result == null) {
1284            try {
1285                Boolean value = Boolean.valueOf(containsSCProductEntry.contains(
1286                            pk, scProductEntryPK));
1287
1288                FinderCache.putResult(finderClassNameCacheEnabled,
1289                    finderClassName, finderMethodName, finderParams,
1290                    finderArgs, value);
1291
1292                return value.booleanValue();
1293            }
1294            catch (DataAccessException dae) {
1295                throw new SystemException(dae);
1296            }
1297        }
1298        else {
1299            return ((Boolean)result).booleanValue();
1300        }
1301    }
1302
1303    public boolean containsSCProductEntries(long pk) throws SystemException {
1304        if (getSCProductEntriesSize(pk) > 0) {
1305            return true;
1306        }
1307        else {
1308            return false;
1309        }
1310    }
1311
1312    public void addSCProductEntry(long pk, long scProductEntryPK)
1313        throws NoSuchLicenseException, 
1314            com.liferay.portlet.softwarecatalog.NoSuchProductEntryException, 
1315            SystemException {
1316        try {
1317            addSCProductEntry.add(pk, scProductEntryPK);
1318        }
1319        catch (DataAccessException dae) {
1320            throw new SystemException(dae);
1321        }
1322        finally {
1323            FinderCache.clearCache("SCLicenses_SCProductEntries");
1324        }
1325    }
1326
1327    public void addSCProductEntry(long pk,
1328        com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry)
1329        throws NoSuchLicenseException, 
1330            com.liferay.portlet.softwarecatalog.NoSuchProductEntryException, 
1331            SystemException {
1332        try {
1333            addSCProductEntry.add(pk, scProductEntry.getPrimaryKey());
1334        }
1335        catch (DataAccessException dae) {
1336            throw new SystemException(dae);
1337        }
1338        finally {
1339            FinderCache.clearCache("SCLicenses_SCProductEntries");
1340        }
1341    }
1342
1343    public void addSCProductEntries(long pk, long[] scProductEntryPKs)
1344        throws NoSuchLicenseException, 
1345            com.liferay.portlet.softwarecatalog.NoSuchProductEntryException, 
1346            SystemException {
1347        try {
1348            for (int i = 0; i < scProductEntryPKs.length; i++) {
1349                addSCProductEntry.add(pk, scProductEntryPKs[i]);
1350            }
1351        }
1352        catch (DataAccessException dae) {
1353            throw new SystemException(dae);
1354        }
1355        finally {
1356            FinderCache.clearCache("SCLicenses_SCProductEntries");
1357        }
1358    }
1359
1360    public void addSCProductEntries(long pk, List scProductEntries)
1361        throws NoSuchLicenseException, 
1362            com.liferay.portlet.softwarecatalog.NoSuchProductEntryException, 
1363            SystemException {
1364        try {
1365            for (int i = 0; i < scProductEntries.size(); i++) {
1366                com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry =
1367                    (com.liferay.portlet.softwarecatalog.model.SCProductEntry)scProductEntries.get(i);
1368
1369                addSCProductEntry.add(pk, scProductEntry.getPrimaryKey());
1370            }
1371        }
1372        catch (DataAccessException dae) {
1373            throw new SystemException(dae);
1374        }
1375        finally {
1376            FinderCache.clearCache("SCLicenses_SCProductEntries");
1377        }
1378    }
1379
1380    public void clearSCProductEntries(long pk)
1381        throws NoSuchLicenseException, SystemException {
1382        try {
1383            clearSCProductEntries.clear(pk);
1384        }
1385        catch (DataAccessException dae) {
1386            throw new SystemException(dae);
1387        }
1388        finally {
1389            FinderCache.clearCache("SCLicenses_SCProductEntries");
1390        }
1391    }
1392
1393    public void removeSCProductEntry(long pk, long scProductEntryPK)
1394        throws NoSuchLicenseException, 
1395            com.liferay.portlet.softwarecatalog.NoSuchProductEntryException, 
1396            SystemException {
1397        try {
1398            removeSCProductEntry.remove(pk, scProductEntryPK);
1399        }
1400        catch (DataAccessException dae) {
1401            throw new SystemException(dae);
1402        }
1403        finally {
1404            FinderCache.clearCache("SCLicenses_SCProductEntries");
1405        }
1406    }
1407
1408    public void removeSCProductEntry(long pk,
1409        com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry)
1410        throws NoSuchLicenseException, 
1411            com.liferay.portlet.softwarecatalog.NoSuchProductEntryException, 
1412            SystemException {
1413        try {
1414            removeSCProductEntry.remove(pk, scProductEntry.getPrimaryKey());
1415        }
1416        catch (DataAccessException dae) {
1417            throw new SystemException(dae);
1418        }
1419        finally {
1420            FinderCache.clearCache("SCLicenses_SCProductEntries");
1421        }
1422    }
1423
1424    public void removeSCProductEntries(long pk, long[] scProductEntryPKs)
1425        throws NoSuchLicenseException, 
1426            com.liferay.portlet.softwarecatalog.NoSuchProductEntryException, 
1427            SystemException {
1428        try {
1429            for (int i = 0; i < scProductEntryPKs.length; i++) {
1430                removeSCProductEntry.remove(pk, scProductEntryPKs[i]);
1431            }
1432        }
1433        catch (DataAccessException dae) {
1434            throw new SystemException(dae);
1435        }
1436        finally {
1437            FinderCache.clearCache("SCLicenses_SCProductEntries");
1438        }
1439    }
1440
1441    public void removeSCProductEntries(long pk, List scProductEntries)
1442        throws NoSuchLicenseException, 
1443            com.liferay.portlet.softwarecatalog.NoSuchProductEntryException, 
1444            SystemException {
1445        try {
1446            for (int i = 0; i < scProductEntries.size(); i++) {
1447                com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry =
1448                    (com.liferay.portlet.softwarecatalog.model.SCProductEntry)scProductEntries.get(i);
1449
1450                removeSCProductEntry.remove(pk, scProductEntry.getPrimaryKey());
1451            }
1452        }
1453        catch (DataAccessException dae) {
1454            throw new SystemException(dae);
1455        }
1456        finally {
1457            FinderCache.clearCache("SCLicenses_SCProductEntries");
1458        }
1459    }
1460
1461    public void setSCProductEntries(long pk, long[] scProductEntryPKs)
1462        throws NoSuchLicenseException, 
1463            com.liferay.portlet.softwarecatalog.NoSuchProductEntryException, 
1464            SystemException {
1465        try {
1466            clearSCProductEntries.clear(pk);
1467
1468            for (int i = 0; i < scProductEntryPKs.length; i++) {
1469                addSCProductEntry.add(pk, scProductEntryPKs[i]);
1470            }
1471        }
1472        catch (DataAccessException dae) {
1473            throw new SystemException(dae);
1474        }
1475        finally {
1476            FinderCache.clearCache("SCLicenses_SCProductEntries");
1477        }
1478    }
1479
1480    public void setSCProductEntries(long pk, List scProductEntries)
1481        throws NoSuchLicenseException, 
1482            com.liferay.portlet.softwarecatalog.NoSuchProductEntryException, 
1483            SystemException {
1484        try {
1485            clearSCProductEntries.clear(pk);
1486
1487            for (int i = 0; i < scProductEntries.size(); i++) {
1488                com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry =
1489                    (com.liferay.portlet.softwarecatalog.model.SCProductEntry)scProductEntries.get(i);
1490
1491                addSCProductEntry.add(pk, scProductEntry.getPrimaryKey());
1492            }
1493        }
1494        catch (DataAccessException dae) {
1495            throw new SystemException(dae);
1496        }
1497        finally {
1498            FinderCache.clearCache("SCLicenses_SCProductEntries");
1499        }
1500    }
1501
1502    protected void initDao() {
1503        containsSCProductEntry = new ContainsSCProductEntry(this);
1504
1505        addSCProductEntry = new AddSCProductEntry(this);
1506        clearSCProductEntries = new ClearSCProductEntries(this);
1507        removeSCProductEntry = new RemoveSCProductEntry(this);
1508    }
1509
1510    protected ContainsSCProductEntry containsSCProductEntry;
1511    protected AddSCProductEntry addSCProductEntry;
1512    protected ClearSCProductEntries clearSCProductEntries;
1513    protected RemoveSCProductEntry removeSCProductEntry;
1514
1515    protected class ContainsSCProductEntry extends MappingSqlQuery {
1516        protected ContainsSCProductEntry(
1517            SCLicensePersistenceImpl persistenceImpl) {
1518            super(persistenceImpl.getDataSource(), _SQL_CONTAINSSCPRODUCTENTRY);
1519
1520            declareParameter(new SqlParameter(Types.BIGINT));
1521            declareParameter(new SqlParameter(Types.BIGINT));
1522
1523            compile();
1524        }
1525
1526        protected Object mapRow(ResultSet rs, int rowNumber)
1527            throws SQLException {
1528            return new Integer(rs.getInt("COUNT_VALUE"));
1529        }
1530
1531        protected boolean contains(long licenseId, long productEntryId) {
1532            List results = execute(new Object[] {
1533                        new Long(licenseId), new Long(productEntryId)
1534                    });
1535
1536            if (results.size() > 0) {
1537                Integer count = (Integer)results.get(0);
1538
1539                if (count.intValue() > 0) {
1540                    return true;
1541                }
1542            }
1543
1544            return false;
1545        }
1546    }
1547
1548    protected class AddSCProductEntry extends SqlUpdate {
1549        protected AddSCProductEntry(SCLicensePersistenceImpl persistenceImpl) {
1550            super(persistenceImpl.getDataSource(),
1551                "INSERT INTO SCLicenses_SCProductEntries (licenseId, productEntryId) VALUES (?, ?)");
1552
1553            _persistenceImpl = persistenceImpl;
1554
1555            declareParameter(new SqlParameter(Types.BIGINT));
1556            declareParameter(new SqlParameter(Types.BIGINT));
1557
1558            compile();
1559        }
1560
1561        protected void add(long licenseId, long productEntryId) {
1562            if (!_persistenceImpl.containsSCProductEntry.contains(licenseId,
1563                        productEntryId)) {
1564                update(new Object[] {
1565                        new Long(licenseId), new Long(productEntryId)
1566                    });
1567            }
1568        }
1569
1570        private SCLicensePersistenceImpl _persistenceImpl;
1571    }
1572
1573    protected class ClearSCProductEntries extends SqlUpdate {
1574        protected ClearSCProductEntries(
1575            SCLicensePersistenceImpl persistenceImpl) {
1576            super(persistenceImpl.getDataSource(),
1577                "DELETE FROM SCLicenses_SCProductEntries WHERE licenseId = ?");
1578
1579            declareParameter(new SqlParameter(Types.BIGINT));
1580
1581            compile();
1582        }
1583
1584        protected void clear(long licenseId) {
1585            update(new Object[] { new Long(licenseId) });
1586        }
1587    }
1588
1589    protected class RemoveSCProductEntry extends SqlUpdate {
1590        protected RemoveSCProductEntry(SCLicensePersistenceImpl persistenceImpl) {
1591            super(persistenceImpl.getDataSource(),
1592                "DELETE FROM SCLicenses_SCProductEntries WHERE licenseId = ? AND productEntryId = ?");
1593
1594            declareParameter(new SqlParameter(Types.BIGINT));
1595            declareParameter(new SqlParameter(Types.BIGINT));
1596
1597            compile();
1598        }
1599
1600        protected void remove(long licenseId, long productEntryId) {
1601            update(new Object[] { new Long(licenseId), new Long(productEntryId) });
1602        }
1603    }
1604
1605    private static ModelListener _getListener() {
1606        if (Validator.isNotNull(_LISTENER)) {
1607            try {
1608                return (ModelListener)Class.forName(_LISTENER).newInstance();
1609            }
1610            catch (Exception e) {
1611                _log.error(e);
1612            }
1613        }
1614
1615        return null;
1616    }
1617
1618    private static final String _SQL_GETSCPRODUCTENTRIES = "SELECT {SCProductEntry.*} FROM SCProductEntry INNER JOIN SCLicenses_SCProductEntries ON (SCLicenses_SCProductEntries.productEntryId = SCProductEntry.productEntryId) WHERE (SCLicenses_SCProductEntries.licenseId = ?)";
1619    private static final String _SQL_GETSCPRODUCTENTRIESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE licenseId = ?";
1620    private static final String _SQL_CONTAINSSCPRODUCTENTRY = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE licenseId = ? AND productEntryId = ?";
1621    private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
1622                "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCLicense"));
1623    private static Log _log = LogFactory.getLog(SCLicensePersistenceImpl.class);
1624}