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