1
22
23 package com.liferay.portlet.imagegallery.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.OrderByComparator;
29 import com.liferay.portal.kernel.util.StringMaker;
30 import com.liferay.portal.kernel.util.StringPool;
31 import com.liferay.portal.service.persistence.BasePersistence;
32 import com.liferay.portal.spring.hibernate.FinderCache;
33 import com.liferay.portal.spring.hibernate.HibernateUtil;
34
35 import com.liferay.portlet.imagegallery.NoSuchFolderException;
36 import com.liferay.portlet.imagegallery.model.IGFolder;
37 import com.liferay.portlet.imagegallery.model.impl.IGFolderImpl;
38
39 import com.liferay.util.dao.hibernate.QueryUtil;
40
41 import org.apache.commons.logging.Log;
42 import org.apache.commons.logging.LogFactory;
43
44 import org.hibernate.Query;
45 import org.hibernate.Session;
46
47 import java.util.Collections;
48 import java.util.Iterator;
49 import java.util.List;
50
51
57 public class IGFolderPersistenceImpl extends BasePersistence
58 implements IGFolderPersistence {
59 public IGFolder create(long folderId) {
60 IGFolder igFolder = new IGFolderImpl();
61 igFolder.setNew(true);
62 igFolder.setPrimaryKey(folderId);
63
64 return igFolder;
65 }
66
67 public IGFolder remove(long folderId)
68 throws NoSuchFolderException, SystemException {
69 Session session = null;
70
71 try {
72 session = openSession();
73
74 IGFolder igFolder = (IGFolder)session.get(IGFolderImpl.class,
75 new Long(folderId));
76
77 if (igFolder == null) {
78 if (_log.isWarnEnabled()) {
79 _log.warn("No IGFolder exists with the primary key " +
80 folderId);
81 }
82
83 throw new NoSuchFolderException(
84 "No IGFolder exists with the primary key " + folderId);
85 }
86
87 return remove(igFolder);
88 }
89 catch (NoSuchFolderException nsee) {
90 throw nsee;
91 }
92 catch (Exception e) {
93 throw HibernateUtil.processException(e);
94 }
95 finally {
96 closeSession(session);
97 }
98 }
99
100 public IGFolder remove(IGFolder igFolder) throws SystemException {
101 Session session = null;
102
103 try {
104 session = openSession();
105 session.delete(igFolder);
106 session.flush();
107
108 return igFolder;
109 }
110 catch (Exception e) {
111 throw HibernateUtil.processException(e);
112 }
113 finally {
114 closeSession(session);
115 FinderCache.clearCache(IGFolder.class.getName());
116 }
117 }
118
119 public IGFolder update(
120 com.liferay.portlet.imagegallery.model.IGFolder igFolder)
121 throws SystemException {
122 return update(igFolder, false);
123 }
124
125 public IGFolder update(
126 com.liferay.portlet.imagegallery.model.IGFolder igFolder, boolean merge)
127 throws SystemException {
128 Session session = null;
129
130 try {
131 session = openSession();
132
133 if (merge) {
134 session.merge(igFolder);
135 }
136 else {
137 if (igFolder.isNew()) {
138 session.save(igFolder);
139 }
140 }
141
142 session.flush();
143 igFolder.setNew(false);
144
145 return igFolder;
146 }
147 catch (Exception e) {
148 throw HibernateUtil.processException(e);
149 }
150 finally {
151 closeSession(session);
152 FinderCache.clearCache(IGFolder.class.getName());
153 }
154 }
155
156 public IGFolder findByPrimaryKey(long folderId)
157 throws NoSuchFolderException, SystemException {
158 IGFolder igFolder = fetchByPrimaryKey(folderId);
159
160 if (igFolder == null) {
161 if (_log.isWarnEnabled()) {
162 _log.warn("No IGFolder exists with the primary key " +
163 folderId);
164 }
165
166 throw new NoSuchFolderException(
167 "No IGFolder exists with the primary key " + folderId);
168 }
169
170 return igFolder;
171 }
172
173 public IGFolder fetchByPrimaryKey(long folderId) throws SystemException {
174 Session session = null;
175
176 try {
177 session = openSession();
178
179 return (IGFolder)session.get(IGFolderImpl.class, new Long(folderId));
180 }
181 catch (Exception e) {
182 throw HibernateUtil.processException(e);
183 }
184 finally {
185 closeSession(session);
186 }
187 }
188
189 public List findByGroupId(long groupId) throws SystemException {
190 String finderClassName = IGFolder.class.getName();
191 String finderMethodName = "findByGroupId";
192 String[] finderParams = new String[] { Long.class.getName() };
193 Object[] finderArgs = new Object[] { new Long(groupId) };
194 Object result = FinderCache.getResult(finderClassName,
195 finderMethodName, finderParams, finderArgs, getSessionFactory());
196
197 if (result == null) {
198 Session session = null;
199
200 try {
201 session = openSession();
202
203 StringMaker query = new StringMaker();
204 query.append(
205 "FROM com.liferay.portlet.imagegallery.model.IGFolder WHERE ");
206 query.append("groupId = ?");
207 query.append(" ");
208 query.append("ORDER BY ");
209 query.append("folderId ASC").append(", ");
210 query.append("name ASC");
211
212 Query q = session.createQuery(query.toString());
213 int queryPos = 0;
214 q.setLong(queryPos++, groupId);
215
216 List list = q.list();
217 FinderCache.putResult(finderClassName, finderMethodName,
218 finderParams, finderArgs, list);
219
220 return list;
221 }
222 catch (Exception e) {
223 throw HibernateUtil.processException(e);
224 }
225 finally {
226 closeSession(session);
227 }
228 }
229 else {
230 return (List)result;
231 }
232 }
233
234 public List findByGroupId(long groupId, int begin, int end)
235 throws SystemException {
236 return findByGroupId(groupId, begin, end, null);
237 }
238
239 public List findByGroupId(long groupId, int begin, int end,
240 OrderByComparator obc) throws SystemException {
241 String finderClassName = IGFolder.class.getName();
242 String finderMethodName = "findByGroupId";
243 String[] finderParams = new String[] {
244 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
245 "com.liferay.portal.kernel.util.OrderByComparator"
246 };
247 Object[] finderArgs = new Object[] {
248 new Long(groupId), String.valueOf(begin), String.valueOf(end),
249 String.valueOf(obc)
250 };
251 Object result = FinderCache.getResult(finderClassName,
252 finderMethodName, finderParams, finderArgs, getSessionFactory());
253
254 if (result == null) {
255 Session session = null;
256
257 try {
258 session = openSession();
259
260 StringMaker query = new StringMaker();
261 query.append(
262 "FROM com.liferay.portlet.imagegallery.model.IGFolder WHERE ");
263 query.append("groupId = ?");
264 query.append(" ");
265
266 if (obc != null) {
267 query.append("ORDER BY ");
268 query.append(obc.getOrderBy());
269 }
270 else {
271 query.append("ORDER BY ");
272 query.append("folderId ASC").append(", ");
273 query.append("name ASC");
274 }
275
276 Query q = session.createQuery(query.toString());
277 int queryPos = 0;
278 q.setLong(queryPos++, groupId);
279
280 List list = QueryUtil.list(q, getDialect(), begin, end);
281 FinderCache.putResult(finderClassName, finderMethodName,
282 finderParams, finderArgs, list);
283
284 return list;
285 }
286 catch (Exception e) {
287 throw HibernateUtil.processException(e);
288 }
289 finally {
290 closeSession(session);
291 }
292 }
293 else {
294 return (List)result;
295 }
296 }
297
298 public IGFolder findByGroupId_First(long groupId, OrderByComparator obc)
299 throws NoSuchFolderException, SystemException {
300 List list = findByGroupId(groupId, 0, 1, obc);
301
302 if (list.size() == 0) {
303 StringMaker msg = new StringMaker();
304 msg.append("No IGFolder exists with the key ");
305 msg.append(StringPool.OPEN_CURLY_BRACE);
306 msg.append("groupId=");
307 msg.append(groupId);
308 msg.append(StringPool.CLOSE_CURLY_BRACE);
309 throw new NoSuchFolderException(msg.toString());
310 }
311 else {
312 return (IGFolder)list.get(0);
313 }
314 }
315
316 public IGFolder findByGroupId_Last(long groupId, OrderByComparator obc)
317 throws NoSuchFolderException, SystemException {
318 int count = countByGroupId(groupId);
319 List list = findByGroupId(groupId, count - 1, count, obc);
320
321 if (list.size() == 0) {
322 StringMaker msg = new StringMaker();
323 msg.append("No IGFolder exists with the key ");
324 msg.append(StringPool.OPEN_CURLY_BRACE);
325 msg.append("groupId=");
326 msg.append(groupId);
327 msg.append(StringPool.CLOSE_CURLY_BRACE);
328 throw new NoSuchFolderException(msg.toString());
329 }
330 else {
331 return (IGFolder)list.get(0);
332 }
333 }
334
335 public IGFolder[] findByGroupId_PrevAndNext(long folderId, long groupId,
336 OrderByComparator obc) throws NoSuchFolderException, SystemException {
337 IGFolder igFolder = findByPrimaryKey(folderId);
338 int count = countByGroupId(groupId);
339 Session session = null;
340
341 try {
342 session = openSession();
343
344 StringMaker query = new StringMaker();
345 query.append(
346 "FROM com.liferay.portlet.imagegallery.model.IGFolder WHERE ");
347 query.append("groupId = ?");
348 query.append(" ");
349
350 if (obc != null) {
351 query.append("ORDER BY ");
352 query.append(obc.getOrderBy());
353 }
354 else {
355 query.append("ORDER BY ");
356 query.append("folderId ASC").append(", ");
357 query.append("name ASC");
358 }
359
360 Query q = session.createQuery(query.toString());
361 int queryPos = 0;
362 q.setLong(queryPos++, groupId);
363
364 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, igFolder);
365 IGFolder[] array = new IGFolderImpl[3];
366 array[0] = (IGFolder)objArray[0];
367 array[1] = (IGFolder)objArray[1];
368 array[2] = (IGFolder)objArray[2];
369
370 return array;
371 }
372 catch (Exception e) {
373 throw HibernateUtil.processException(e);
374 }
375 finally {
376 closeSession(session);
377 }
378 }
379
380 public List findByG_P(long groupId, long parentFolderId)
381 throws SystemException {
382 String finderClassName = IGFolder.class.getName();
383 String finderMethodName = "findByG_P";
384 String[] finderParams = new String[] {
385 Long.class.getName(), Long.class.getName()
386 };
387 Object[] finderArgs = new Object[] {
388 new Long(groupId), new Long(parentFolderId)
389 };
390 Object result = FinderCache.getResult(finderClassName,
391 finderMethodName, finderParams, finderArgs, getSessionFactory());
392
393 if (result == null) {
394 Session session = null;
395
396 try {
397 session = openSession();
398
399 StringMaker query = new StringMaker();
400 query.append(
401 "FROM com.liferay.portlet.imagegallery.model.IGFolder WHERE ");
402 query.append("groupId = ?");
403 query.append(" AND ");
404 query.append("parentFolderId = ?");
405 query.append(" ");
406 query.append("ORDER BY ");
407 query.append("folderId ASC").append(", ");
408 query.append("name ASC");
409
410 Query q = session.createQuery(query.toString());
411 int queryPos = 0;
412 q.setLong(queryPos++, groupId);
413 q.setLong(queryPos++, parentFolderId);
414
415 List list = q.list();
416 FinderCache.putResult(finderClassName, finderMethodName,
417 finderParams, finderArgs, list);
418
419 return list;
420 }
421 catch (Exception e) {
422 throw HibernateUtil.processException(e);
423 }
424 finally {
425 closeSession(session);
426 }
427 }
428 else {
429 return (List)result;
430 }
431 }
432
433 public List findByG_P(long groupId, long parentFolderId, int begin, int end)
434 throws SystemException {
435 return findByG_P(groupId, parentFolderId, begin, end, null);
436 }
437
438 public List findByG_P(long groupId, long parentFolderId, int begin,
439 int end, OrderByComparator obc) throws SystemException {
440 String finderClassName = IGFolder.class.getName();
441 String finderMethodName = "findByG_P";
442 String[] finderParams = new String[] {
443 Long.class.getName(), Long.class.getName(), "java.lang.Integer",
444 "java.lang.Integer",
445 "com.liferay.portal.kernel.util.OrderByComparator"
446 };
447 Object[] finderArgs = new Object[] {
448 new Long(groupId), new Long(parentFolderId),
449 String.valueOf(begin), String.valueOf(end), String.valueOf(obc)
450 };
451 Object result = FinderCache.getResult(finderClassName,
452 finderMethodName, finderParams, finderArgs, getSessionFactory());
453
454 if (result == null) {
455 Session session = null;
456
457 try {
458 session = openSession();
459
460 StringMaker query = new StringMaker();
461 query.append(
462 "FROM com.liferay.portlet.imagegallery.model.IGFolder WHERE ");
463 query.append("groupId = ?");
464 query.append(" AND ");
465 query.append("parentFolderId = ?");
466 query.append(" ");
467
468 if (obc != null) {
469 query.append("ORDER BY ");
470 query.append(obc.getOrderBy());
471 }
472 else {
473 query.append("ORDER BY ");
474 query.append("folderId ASC").append(", ");
475 query.append("name ASC");
476 }
477
478 Query q = session.createQuery(query.toString());
479 int queryPos = 0;
480 q.setLong(queryPos++, groupId);
481 q.setLong(queryPos++, parentFolderId);
482
483 List list = QueryUtil.list(q, getDialect(), begin, end);
484 FinderCache.putResult(finderClassName, finderMethodName,
485 finderParams, finderArgs, list);
486
487 return list;
488 }
489 catch (Exception e) {
490 throw HibernateUtil.processException(e);
491 }
492 finally {
493 closeSession(session);
494 }
495 }
496 else {
497 return (List)result;
498 }
499 }
500
501 public IGFolder findByG_P_First(long groupId, long parentFolderId,
502 OrderByComparator obc) throws NoSuchFolderException, SystemException {
503 List list = findByG_P(groupId, parentFolderId, 0, 1, obc);
504
505 if (list.size() == 0) {
506 StringMaker msg = new StringMaker();
507 msg.append("No IGFolder exists with the key ");
508 msg.append(StringPool.OPEN_CURLY_BRACE);
509 msg.append("groupId=");
510 msg.append(groupId);
511 msg.append(", ");
512 msg.append("parentFolderId=");
513 msg.append(parentFolderId);
514 msg.append(StringPool.CLOSE_CURLY_BRACE);
515 throw new NoSuchFolderException(msg.toString());
516 }
517 else {
518 return (IGFolder)list.get(0);
519 }
520 }
521
522 public IGFolder findByG_P_Last(long groupId, long parentFolderId,
523 OrderByComparator obc) throws NoSuchFolderException, SystemException {
524 int count = countByG_P(groupId, parentFolderId);
525 List list = findByG_P(groupId, parentFolderId, count - 1, count, obc);
526
527 if (list.size() == 0) {
528 StringMaker msg = new StringMaker();
529 msg.append("No IGFolder exists with the key ");
530 msg.append(StringPool.OPEN_CURLY_BRACE);
531 msg.append("groupId=");
532 msg.append(groupId);
533 msg.append(", ");
534 msg.append("parentFolderId=");
535 msg.append(parentFolderId);
536 msg.append(StringPool.CLOSE_CURLY_BRACE);
537 throw new NoSuchFolderException(msg.toString());
538 }
539 else {
540 return (IGFolder)list.get(0);
541 }
542 }
543
544 public IGFolder[] findByG_P_PrevAndNext(long folderId, long groupId,
545 long parentFolderId, OrderByComparator obc)
546 throws NoSuchFolderException, SystemException {
547 IGFolder igFolder = findByPrimaryKey(folderId);
548 int count = countByG_P(groupId, parentFolderId);
549 Session session = null;
550
551 try {
552 session = openSession();
553
554 StringMaker query = new StringMaker();
555 query.append(
556 "FROM com.liferay.portlet.imagegallery.model.IGFolder WHERE ");
557 query.append("groupId = ?");
558 query.append(" AND ");
559 query.append("parentFolderId = ?");
560 query.append(" ");
561
562 if (obc != null) {
563 query.append("ORDER BY ");
564 query.append(obc.getOrderBy());
565 }
566 else {
567 query.append("ORDER BY ");
568 query.append("folderId ASC").append(", ");
569 query.append("name ASC");
570 }
571
572 Query q = session.createQuery(query.toString());
573 int queryPos = 0;
574 q.setLong(queryPos++, groupId);
575 q.setLong(queryPos++, parentFolderId);
576
577 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, igFolder);
578 IGFolder[] array = new IGFolderImpl[3];
579 array[0] = (IGFolder)objArray[0];
580 array[1] = (IGFolder)objArray[1];
581 array[2] = (IGFolder)objArray[2];
582
583 return array;
584 }
585 catch (Exception e) {
586 throw HibernateUtil.processException(e);
587 }
588 finally {
589 closeSession(session);
590 }
591 }
592
593 public List findWithDynamicQuery(DynamicQueryInitializer queryInitializer)
594 throws SystemException {
595 Session session = null;
596
597 try {
598 session = openSession();
599
600 DynamicQuery query = queryInitializer.initialize(session);
601
602 return query.list();
603 }
604 catch (Exception e) {
605 throw HibernateUtil.processException(e);
606 }
607 finally {
608 closeSession(session);
609 }
610 }
611
612 public List findWithDynamicQuery(DynamicQueryInitializer queryInitializer,
613 int begin, int end) throws SystemException {
614 Session session = null;
615
616 try {
617 session = openSession();
618
619 DynamicQuery query = queryInitializer.initialize(session);
620 query.setLimit(begin, end);
621
622 return query.list();
623 }
624 catch (Exception e) {
625 throw HibernateUtil.processException(e);
626 }
627 finally {
628 closeSession(session);
629 }
630 }
631
632 public List findAll() throws SystemException {
633 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
634 }
635
636 public List findAll(int begin, int end) throws SystemException {
637 return findAll(begin, end, null);
638 }
639
640 public List findAll(int begin, int end, OrderByComparator obc)
641 throws SystemException {
642 String finderClassName = IGFolder.class.getName();
643 String finderMethodName = "findAll";
644 String[] finderParams = new String[] {
645 "java.lang.Integer", "java.lang.Integer",
646 "com.liferay.portal.kernel.util.OrderByComparator"
647 };
648 Object[] finderArgs = new Object[] {
649 String.valueOf(begin), String.valueOf(end), String.valueOf(obc)
650 };
651 Object result = FinderCache.getResult(finderClassName,
652 finderMethodName, finderParams, finderArgs, getSessionFactory());
653
654 if (result == null) {
655 Session session = null;
656
657 try {
658 session = openSession();
659
660 StringMaker query = new StringMaker();
661 query.append(
662 "FROM com.liferay.portlet.imagegallery.model.IGFolder ");
663
664 if (obc != null) {
665 query.append("ORDER BY ");
666 query.append(obc.getOrderBy());
667 }
668 else {
669 query.append("ORDER BY ");
670 query.append("folderId ASC").append(", ");
671 query.append("name ASC");
672 }
673
674 Query q = session.createQuery(query.toString());
675 List list = QueryUtil.list(q, getDialect(), begin, end);
676
677 if (obc == null) {
678 Collections.sort(list);
679 }
680
681 FinderCache.putResult(finderClassName, finderMethodName,
682 finderParams, finderArgs, list);
683
684 return list;
685 }
686 catch (Exception e) {
687 throw HibernateUtil.processException(e);
688 }
689 finally {
690 closeSession(session);
691 }
692 }
693 else {
694 return (List)result;
695 }
696 }
697
698 public void removeByGroupId(long groupId) throws SystemException {
699 Iterator itr = findByGroupId(groupId).iterator();
700
701 while (itr.hasNext()) {
702 IGFolder igFolder = (IGFolder)itr.next();
703 remove(igFolder);
704 }
705 }
706
707 public void removeByG_P(long groupId, long parentFolderId)
708 throws SystemException {
709 Iterator itr = findByG_P(groupId, parentFolderId).iterator();
710
711 while (itr.hasNext()) {
712 IGFolder igFolder = (IGFolder)itr.next();
713 remove(igFolder);
714 }
715 }
716
717 public void removeAll() throws SystemException {
718 Iterator itr = findAll().iterator();
719
720 while (itr.hasNext()) {
721 remove((IGFolder)itr.next());
722 }
723 }
724
725 public int countByGroupId(long groupId) throws SystemException {
726 String finderClassName = IGFolder.class.getName();
727 String finderMethodName = "countByGroupId";
728 String[] finderParams = new String[] { Long.class.getName() };
729 Object[] finderArgs = new Object[] { new Long(groupId) };
730 Object result = FinderCache.getResult(finderClassName,
731 finderMethodName, finderParams, finderArgs, getSessionFactory());
732
733 if (result == null) {
734 Session session = null;
735
736 try {
737 session = openSession();
738
739 StringMaker query = new StringMaker();
740 query.append("SELECT COUNT(*) ");
741 query.append(
742 "FROM com.liferay.portlet.imagegallery.model.IGFolder WHERE ");
743 query.append("groupId = ?");
744 query.append(" ");
745
746 Query q = session.createQuery(query.toString());
747 int queryPos = 0;
748 q.setLong(queryPos++, groupId);
749
750 Long count = null;
751 Iterator itr = q.list().iterator();
752
753 if (itr.hasNext()) {
754 count = (Long)itr.next();
755 }
756
757 if (count == null) {
758 count = new Long(0);
759 }
760
761 FinderCache.putResult(finderClassName, finderMethodName,
762 finderParams, finderArgs, count);
763
764 return count.intValue();
765 }
766 catch (Exception e) {
767 throw HibernateUtil.processException(e);
768 }
769 finally {
770 closeSession(session);
771 }
772 }
773 else {
774 return ((Long)result).intValue();
775 }
776 }
777
778 public int countByG_P(long groupId, long parentFolderId)
779 throws SystemException {
780 String finderClassName = IGFolder.class.getName();
781 String finderMethodName = "countByG_P";
782 String[] finderParams = new String[] {
783 Long.class.getName(), Long.class.getName()
784 };
785 Object[] finderArgs = new Object[] {
786 new Long(groupId), new Long(parentFolderId)
787 };
788 Object result = FinderCache.getResult(finderClassName,
789 finderMethodName, finderParams, finderArgs, getSessionFactory());
790
791 if (result == null) {
792 Session session = null;
793
794 try {
795 session = openSession();
796
797 StringMaker query = new StringMaker();
798 query.append("SELECT COUNT(*) ");
799 query.append(
800 "FROM com.liferay.portlet.imagegallery.model.IGFolder WHERE ");
801 query.append("groupId = ?");
802 query.append(" AND ");
803 query.append("parentFolderId = ?");
804 query.append(" ");
805
806 Query q = session.createQuery(query.toString());
807 int queryPos = 0;
808 q.setLong(queryPos++, groupId);
809 q.setLong(queryPos++, parentFolderId);
810
811 Long count = null;
812 Iterator itr = q.list().iterator();
813
814 if (itr.hasNext()) {
815 count = (Long)itr.next();
816 }
817
818 if (count == null) {
819 count = new Long(0);
820 }
821
822 FinderCache.putResult(finderClassName, finderMethodName,
823 finderParams, finderArgs, count);
824
825 return count.intValue();
826 }
827 catch (Exception e) {
828 throw HibernateUtil.processException(e);
829 }
830 finally {
831 closeSession(session);
832 }
833 }
834 else {
835 return ((Long)result).intValue();
836 }
837 }
838
839 public int countAll() throws SystemException {
840 String finderClassName = IGFolder.class.getName();
841 String finderMethodName = "countAll";
842 String[] finderParams = new String[] { };
843 Object[] finderArgs = new Object[] { };
844 Object result = FinderCache.getResult(finderClassName,
845 finderMethodName, finderParams, finderArgs, getSessionFactory());
846
847 if (result == null) {
848 Session session = null;
849
850 try {
851 session = openSession();
852
853 StringMaker query = new StringMaker();
854 query.append("SELECT COUNT(*) ");
855 query.append(
856 "FROM com.liferay.portlet.imagegallery.model.IGFolder");
857
858 Query q = session.createQuery(query.toString());
859 Long count = null;
860 Iterator itr = q.list().iterator();
861
862 if (itr.hasNext()) {
863 count = (Long)itr.next();
864 }
865
866 if (count == null) {
867 count = new Long(0);
868 }
869
870 FinderCache.putResult(finderClassName, finderMethodName,
871 finderParams, finderArgs, count);
872
873 return count.intValue();
874 }
875 catch (Exception e) {
876 throw HibernateUtil.processException(e);
877 }
878 finally {
879 closeSession(session);
880 }
881 }
882 else {
883 return ((Long)result).intValue();
884 }
885 }
886
887 protected void initDao() {
888 }
889
890 private static Log _log = LogFactory.getLog(IGFolderPersistenceImpl.class);
891 }