View Javadoc
1   // license-header java merge-point
2   //
3   // Attention: Generated code! Do not modify by hand!
4   // Generated by: hibernate/SpringHibernateDaoBase.vsl in <project>/mda/src/main/cartridge/custom/...
5   //
6   package fr.ifremer.quadrige3.core.dao.administration.strategy;
7   
8   /*-
9    * #%L
10   * Quadrige3 Core :: Client API
11   * %%
12   * Copyright (C) 2017 - 2024 Ifremer
13   * %%
14   * This program is free software: you can redistribute it and/or modify
15   * it under the terms of the GNU Affero General Public License as published by
16   * the Free Software Foundation, either version 3 of the License, or
17   * (at your option) any later version.
18   * 
19   * This program is distributed in the hope that it will be useful,
20   * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22   * GNU General Public License for more details.
23   * 
24   * You should have received a copy of the GNU Affero General Public License
25   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
26   * #L%
27   */
28  import fr.ifremer.quadrige3.core.dao.PrincipalStore;
29  import fr.ifremer.quadrige3.core.dao.PropertySearch;
30  import fr.ifremer.quadrige3.core.dao.Search;
31  import fr.ifremer.quadrige3.core.dao.referential.pmfm.Pmfm;
32  import fr.ifremer.quadrige3.core.dao.technical.hibernate.HibernateDaoSupport;
33  import fr.ifremer.quadrige3.core.vo.administration.strategy.PmfmStrategyVO;
34  import java.security.Principal;
35  import java.sql.Timestamp;
36  import java.util.ArrayList;
37  import java.util.Collection;
38  import java.util.Iterator;
39  import java.util.LinkedHashSet;
40  import java.util.List;
41  import java.util.Set;
42  import javax.annotation.Resource;
43  import org.andromda.spring.PaginationResult;
44  import org.apache.commons.collections.CollectionUtils;
45  import org.apache.commons.collections.Transformer;
46  import org.hibernate.Criteria;
47  import org.hibernate.HibernateException;
48  import org.hibernate.Query;
49  import org.hibernate.ScrollableResults;
50  
51  /**
52   * <p>
53   * Base Spring DAO Class: is able to create, update, remove, load, and find
54   * objects of type <code>PmfmStrategy</code>.
55   * </p>
56   *
57   * @see PmfmStrategy
58   */
59  public abstract class PmfmStrategyDaoBase
60      extends HibernateDaoSupport    
61      implements PmfmStrategyDao
62  {
63      /**
64       * {@inheritDoc}
65       */
66      @Override
67      public Object get(final int transform, final Integer pmfmStratId)
68      {
69          if (pmfmStratId == null)
70          {
71              throw new IllegalArgumentException(
72                  "PmfmStrategy.get - 'pmfmStratId' can not be null");
73          }
74          final PmfmStrategy entity = get(PmfmStrategyImpl.class, pmfmStratId);
75          return transformEntity(transform, entity);
76      }
77      /**
78       * {@inheritDoc}
79       */
80      @Override
81      public PmfmStrategy get(Integer pmfmStratId)
82      {
83          return (PmfmStrategy)this.get(TRANSFORM_NONE, pmfmStratId);
84      }
85  
86      /**
87       * {@inheritDoc}
88       */
89      @Override
90      public Object load(final int transform, final Integer pmfmStratId)
91      {
92          if (pmfmStratId == null)
93          {
94              throw new IllegalArgumentException(
95                  "PmfmStrategy.load - 'pmfmStratId' can not be null");
96          }
97          final PmfmStrategy entity = get(PmfmStrategyImpl.class, pmfmStratId);
98          return transformEntity(transform, entity);
99      }
100 
101     /**
102      * {@inheritDoc}
103      */
104     @Override
105     public PmfmStrategy load(Integer pmfmStratId)
106     {
107         return (PmfmStrategy)this.load(TRANSFORM_NONE, pmfmStratId);
108     }
109 
110     /**
111      * {@inheritDoc}
112      */
113     @Override
114     @SuppressWarnings({"unchecked"})
115     public Collection<PmfmStrategy> loadAll()
116     {
117         return (Collection<PmfmStrategy>) this.loadAll(PmfmStrategyDao.TRANSFORM_NONE);
118     }
119 
120     /**
121      * {@inheritDoc}
122      */
123     @Override
124     public Collection<?> loadAll(final int transform)
125     {
126         return this.loadAll(transform, -1, -1);
127     }
128 
129     /**
130      * {@inheritDoc}
131      */
132     @Override
133     public Collection<?> loadAll(final int pageNumber, final int pageSize)
134     {
135         return this.loadAll(PmfmStrategyDao.TRANSFORM_NONE, pageNumber, pageSize);
136     }
137 
138     /**
139      * {@inheritDoc}
140      */
141     @Override
142     public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize)
143     {
144         try
145         {
146             final Criteria criteria = this.getSession().createCriteria(PmfmStrategyImpl.class);
147             if (pageNumber > 0 && pageSize > 0)
148             {
149                 criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
150                 criteria.setMaxResults(pageSize);
151             }
152             final Collection<?> results = criteria.list();
153             this.transformEntities(transform, results);
154             return results;
155         }
156         catch (HibernateException ex)
157         {
158             throw ex;
159         }
160     }
161 
162     /**
163      * firstResult = (pageNumber - 1) * pageSize
164      * @param pageNumber
165      * @param pageSize
166      * @return firstResult
167      */
168     protected int calculateFirstResult(int pageNumber, int pageSize)
169     {
170         int firstResult = 0;
171         if (pageNumber > 0)
172         {
173             firstResult = (pageNumber - 1) * pageSize;
174         }
175         return firstResult;
176     }
177 
178     /**
179      * {@inheritDoc}
180      */
181     @Override
182     public PmfmStrategy create(PmfmStrategy pmfmStrategy)
183     {
184         return (PmfmStrategy)this.create(PmfmStrategyDao.TRANSFORM_NONE, pmfmStrategy);
185     }
186 
187     /**
188      * {@inheritDoc}
189      */
190     @Override
191     public Object create(final int transform, final PmfmStrategy pmfmStrategy)
192     {
193         if (pmfmStrategy == null)
194         {
195             throw new IllegalArgumentException(
196                 "PmfmStrategy.create - 'pmfmStrategy' can not be null");
197         }
198         this.getSessionFactory().getCurrentSession().save(pmfmStrategy);
199         return this.transformEntity(transform, pmfmStrategy);
200     }
201 
202     /**
203      * {@inheritDoc}
204      */
205     @Override
206     @SuppressWarnings({"unchecked"})
207     public Collection<PmfmStrategy> create(final Collection<PmfmStrategy> entities)
208     {
209         return (Collection<PmfmStrategy>) create(PmfmStrategyDao.TRANSFORM_NONE, entities);
210     }
211 
212     /**
213      * {@inheritDoc}
214      */
215     @Override
216     public Collection<?> create(final int transform, final Collection<PmfmStrategy> entities)
217     {
218         if (entities == null)
219         {
220             throw new IllegalArgumentException(
221                 "PmfmStrategy.create - 'entities' can not be null");
222         }
223                     for (PmfmStrategy entity : entities)
224                     {
225                         create(transform, entity);
226                     }
227         return entities;
228     }
229 
230     /**
231      * {@inheritDoc}
232      */
233     @Override
234     public PmfmStrategy create(
235         Integer pmfmStratParAcquisNumber,
236         Integer pmfmStratPresRk,
237         String pmfmStratParIsIndiv,
238         String pmfmStratIsUniqueByTaxon,
239         Timestamp updateDt)
240     {
241         return (PmfmStrategy)this.create(PmfmStrategyDao.TRANSFORM_NONE, pmfmStratParAcquisNumber, pmfmStratPresRk, pmfmStratParIsIndiv, pmfmStratIsUniqueByTaxon, updateDt);
242     }
243 
244     /**
245      * {@inheritDoc}
246      */
247     @Override
248     public Object create(
249         final int transform,
250         Integer pmfmStratParAcquisNumber,
251         Integer pmfmStratPresRk,
252         String pmfmStratParIsIndiv,
253         String pmfmStratIsUniqueByTaxon,
254         Timestamp updateDt)
255     {
256         PmfmStrategy entity = new PmfmStrategyImpl();
257         entity.setPmfmStratParAcquisNumber(pmfmStratParAcquisNumber);
258         entity.setPmfmStratPresRk(pmfmStratPresRk);
259         entity.setPmfmStratParIsIndiv(pmfmStratParIsIndiv);
260         entity.setPmfmStratIsUniqueByTaxon(pmfmStratIsUniqueByTaxon);
261         entity.setUpdateDt(updateDt);
262         return this.create(transform, entity);
263     }
264 
265     /**
266      * {@inheritDoc}
267      */
268     @Override
269     public PmfmStrategy create(
270         Integer pmfmStratParAcquisNumber,
271         Pmfm pmfm,
272         Strategy strategy)
273     {
274         return (PmfmStrategy)this.create(PmfmStrategyDao.TRANSFORM_NONE, pmfmStratParAcquisNumber, pmfm, strategy);
275     }
276 
277     /**
278      * {@inheritDoc}
279      */
280     @Override
281     public Object create(
282         final int transform,
283         Integer pmfmStratParAcquisNumber,
284         Pmfm pmfm,
285         Strategy strategy)
286     {
287         PmfmStrategy entity = new PmfmStrategyImpl();
288         entity.setPmfmStratParAcquisNumber(pmfmStratParAcquisNumber);
289         entity.setPmfm(pmfm);
290         entity.setStrategy(strategy);
291         return this.create(transform, entity);
292     }
293 
294     /**
295      * {@inheritDoc}
296      */
297     @Override
298     public void update(PmfmStrategy pmfmStrategy)
299     {
300         if (pmfmStrategy == null)
301         {
302             throw new IllegalArgumentException(
303                 "PmfmStrategy.update - 'pmfmStrategy' can not be null");
304         }
305         this.getSessionFactory().getCurrentSession().update(pmfmStrategy);
306     }
307 
308     /**
309      * {@inheritDoc}
310      */
311     @Override
312     public void update(final Collection<PmfmStrategy> entities)
313     {
314         if (entities == null)
315         {
316             throw new IllegalArgumentException(
317                 "PmfmStrategy.update - 'entities' can not be null");
318         }
319                     for (PmfmStrategy entity : entities)
320                     {
321                         update(entity);
322                     }
323     }
324 
325     /**
326      * {@inheritDoc}
327      */
328     @Override
329     public void remove(PmfmStrategy pmfmStrategy)
330     {
331         if (pmfmStrategy == null)
332         {
333             throw new IllegalArgumentException(
334                 "PmfmStrategy.remove - 'pmfmStrategy' can not be null");
335         }
336         this.getSessionFactory().getCurrentSession().delete(pmfmStrategy);
337     }
338 
339     /**
340      * {@inheritDoc}
341      */
342     @Override
343     public void remove(Integer pmfmStratId)
344     {
345         if (pmfmStratId == null)
346         {
347             throw new IllegalArgumentException(
348                 "PmfmStrategy.remove - 'pmfmStratId' can not be null");
349         }
350         PmfmStrategy entity = this.get(pmfmStratId);
351         if (entity != null)
352         {
353             this.remove(entity);
354         }
355     }
356 
357     /**
358      * {@inheritDoc}
359      */
360     @Override
361     public void remove(Collection<PmfmStrategy> entities)
362     {
363         if (entities == null)
364         {
365             throw new IllegalArgumentException(
366                 "PmfmStrategy.remove - 'entities' can not be null");
367         }
368         deleteAll(entities);
369     }
370     /**
371      * {@inheritDoc}
372      */
373     @Override
374     public PmfmStrategyVO save(final PmfmStrategyVO pmfmStrategy, final Timestamp updateDt)
375     {
376         if (pmfmStrategy == null)
377         {
378             throw new IllegalArgumentException(
379                 "fr.ifremer.quadrige3.core.dao.administration.strategy.PmfmStrategyDao.save(PmfmStrategyVO pmfmStrategy, Timestamp updateDt) - 'pmfmStrategy' can not be null");
380         }
381         try
382         {
383             return this.handleSave(pmfmStrategy, updateDt);
384         }
385         catch (Throwable th)
386         {
387             throw new RuntimeException(
388             "Error performing 'PmfmStrategyDao.save(PmfmStrategyVO pmfmStrategy, Timestamp updateDt)' --> " + th,
389             th);
390         }
391     }
392 
393     /**
394      * Performs the core logic for {@link #save(PmfmStrategyVO, Timestamp)}
395      * @param pmfmStrategy
396      * @param updateDt
397      * @return PmfmStrategyVO
398      * @throws Exception
399      */
400     protected abstract PmfmStrategyVO handleSave(PmfmStrategyVO pmfmStrategy, Timestamp updateDt)
401         throws Exception;
402 
403     /**
404      * Allows transformation of entities into value objects
405      * (or something else for that matter), when the <code>transform</code>
406      * flag is set to one of the constants defined in <code>PmfmStrategyDao</code>, please note
407      * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
408      * will be returned.
409      * <p>
410      * This method will return instances of these types:
411      * <ul>
412      *   <li>{@link PmfmStrategy} - {@link #TRANSFORM_NONE}</li>
413      *   <li>{@link PmfmStrategyVO} - {@link #TRANSFORM_PMFMSTRATEGYVO}</li>
414      * </ul>
415      *
416      * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
417      *
418      * @param transform one of the constants declared in {@link PmfmStrategyDao}
419      * @param entity an entity that was found
420      * @return the transformed entity (i.e. new value object, etc)
421      * @see PmfmStrategyDao#transformEntity(int, PmfmStrategy)
422      */
423     public Object transformEntity(final int transform, final PmfmStrategy entity)
424     {
425         Object target = null;
426         if (entity != null)
427         {
428             switch (transform)
429             {
430                 case TRANSFORM_PMFMSTRATEGYVO :
431                     target = toPmfmStrategyVO(entity);
432                     break;
433                 case PmfmStrategyDao.TRANSFORM_NONE : // fall-through
434                 default:
435                     target = entity;
436             }
437         }
438         return target;
439     }
440 
441     /**
442      * {@inheritDoc}
443      */
444     @Override
445     public void transformEntities(final int transform, final Collection<?> entities)
446     {
447         switch (transform)
448         {
449             case TRANSFORM_PMFMSTRATEGYVO :
450                 toPmfmStrategyVOCollection(entities);
451                 break;
452             case PmfmStrategyDao.TRANSFORM_NONE : // fall-through
453                 default:
454                 // do nothing;
455         }
456     }
457 
458     /**
459      * @see PmfmStrategyDao#toEntities(Collection)
460      */
461     public void toEntities(final Collection<?> results)
462     {
463         if (results != null)
464         {
465             CollectionUtils.transform(results, this.ENTITYTRANSFORMER);
466         }
467     }
468 
469     /**
470      * This anonymous transformer is designed to transform report query results
471      * (which result in an array of entities) to {@link PmfmStrategy}
472      * using the Jakarta Commons-Collections Transformation API.
473      */
474     private Transformer ENTITYTRANSFORMER =
475         new Transformer()
476         {
477             public Object transform(Object input)
478             {
479                 Object result = null;
480                 if (input instanceof Object[])
481                 {
482                     result = toEntity((Object[])input);
483                 }
484                 else if (input instanceof PmfmStrategy)
485                 {
486                     result = input;
487                 }
488                 return result;
489             }
490         };
491 
492     /**
493      * @param row
494      * @return PmfmStrategy
495      */
496     protected PmfmStrategy toEntity(Object[] row)
497     {
498         PmfmStrategy target = null;
499         if (row != null)
500         {
501             final int numberOfObjects = row.length;
502             for (int ctr = 0; ctr < numberOfObjects; ctr++)
503             {
504                 final Object object = row[ctr];
505                 if (object instanceof PmfmStrategy)
506                 {
507                     target = (PmfmStrategy)object;
508                     break;
509                 }
510             }
511         }
512         return target;
513     }
514 
515     /**
516      * {@inheritDoc}
517      */
518     @Override
519     @SuppressWarnings({"unchecked"})
520     public final Collection<PmfmStrategyVO> toPmfmStrategyVOCollection(Collection<?> entities)
521     {
522         Collection<PmfmStrategyVO> result = new ArrayList<PmfmStrategyVO>();
523         if (entities != null)
524         {
525             CollectionUtils.transform(entities, this.PMFMSTRATEGYVO_TRANSFORMER);
526             result.addAll((Collection<? extends PmfmStrategyVO>) entities);
527         }
528         return result;
529     }
530 
531     /**
532      * {@inheritDoc}
533      */
534     @Override
535     @SuppressWarnings({ "unchecked" })
536     public final PmfmStrategyVO[] toPmfmStrategyVOArray(Collection<?> entities)
537     {
538         PmfmStrategyVO[] result = null;
539         if (entities != null)
540         {
541             // Unchecked transformation: reuses entities Collection
542             final Collection collection = new ArrayList(entities);
543             this.toPmfmStrategyVOCollection(collection);
544             result = (PmfmStrategyVO[]) collection.toArray(new PmfmStrategyVO[collection.size()]);
545         }
546         return result;
547     }
548 
549     /**
550      * Default implementation for transforming the results of a report query into a value object. This
551      * implementation exists for convenience reasons only. It needs only be overridden in the
552      * {@link PmfmStrategyDaoImpl} class if you intend to use reporting queries.
553      * @param row
554      * @return toPmfmStrategyVO(this.toEntity(row))
555      * @see PmfmStrategyDao#toPmfmStrategyVO(PmfmStrategy)
556      */
557     protected PmfmStrategyVO toPmfmStrategyVO(Object[] row)
558     {
559         return this.toPmfmStrategyVO(this.toEntity(row));
560     }
561 
562     /**
563      * This anonymous transformer is designed to transform entities or report query results
564      * (which result in an array of objects) to {@link PmfmStrategyVO}
565      * using the Jakarta Commons-Collections Transformation API.
566      */
567     private Transformer PMFMSTRATEGYVO_TRANSFORMER =
568         new Transformer()
569         {
570             public Object transform(Object input)
571             {
572                 Object result = null;
573                 if (input instanceof PmfmStrategy)
574                 {
575                     result = toPmfmStrategyVO((PmfmStrategy)input);
576                 }
577                 else if (input instanceof Object[])
578                 {
579                     result = toPmfmStrategyVO((Object[])input);
580                 }
581                 return result;
582             }
583         };
584 
585     /**
586      * {@inheritDoc}
587      */
588     @Override
589     public final void pmfmStrategyVOToEntityCollection(Collection<?> instances)
590     {
591         if (instances != null)
592         {
593             for (final Iterator<?> iterator = instances.iterator(); iterator.hasNext();)
594             {
595                 // - remove an objects that are null or not of the correct instance
596                 if (!(iterator.next() instanceof PmfmStrategyVO))
597                 {
598                     iterator.remove();
599                 }
600             }
601             CollectionUtils.transform(instances, this.PmfmStrategyVOToEntityTransformer);
602         }
603     }
604 
605     private final Transformer PmfmStrategyVOToEntityTransformer =
606         new Transformer()
607         {
608             public Object transform(Object input)
609             {
610                 return pmfmStrategyVOToEntity((PmfmStrategyVO)input);
611             }
612         };
613 
614 
615     /**
616      * {@inheritDoc}
617      */
618     @Override
619     public void toPmfmStrategyVO(
620         PmfmStrategy source,
621         PmfmStrategyVO target)
622     {
623         target.setPmfmStratId(source.getPmfmStratId());
624         target.setPmfmStratParAcquisNumber(new Double((double)(source.getPmfmStratParAcquisNumber() == null ? 0 : source.getPmfmStratParAcquisNumber().intValue())));
625         target.setPmfmStratPresRk(source.getPmfmStratPresRk());
626         target.setPmfmStratParIsIndiv(source.getPmfmStratParIsIndiv());
627         target.setPmfmStratIsUniqueByTaxon(source.getPmfmStratIsUniqueByTaxon());
628         target.setUpdateDt(source.getUpdateDt());
629     }
630 
631     /**
632      * {@inheritDoc}
633      */
634     @Override
635     public PmfmStrategyVO toPmfmStrategyVO(final PmfmStrategy entity)
636     {
637         PmfmStrategyVO target = null;
638         if (entity != null)
639         {
640             target =  new PmfmStrategyVO();
641             this.toPmfmStrategyVO(entity, target);
642         }
643         return target;
644     }
645 
646     /**
647      * {@inheritDoc}
648      */
649     @Override
650     public void pmfmStrategyVOToEntity(
651         PmfmStrategyVO source,
652         PmfmStrategy target,
653         boolean copyIfNull)
654     {
655         if (copyIfNull || source.getPmfmStratParAcquisNumber() != null)
656         {
657             target.setPmfmStratParAcquisNumber(new Integer((int)(source.getPmfmStratParAcquisNumber() == null ? 0.0 : source.getPmfmStratParAcquisNumber().doubleValue())));
658         }
659         if (copyIfNull || source.getPmfmStratPresRk() != null)
660         {
661             target.setPmfmStratPresRk(source.getPmfmStratPresRk());
662         }
663         if (copyIfNull || source.getPmfmStratParIsIndiv() != null)
664         {
665             target.setPmfmStratParIsIndiv(source.getPmfmStratParIsIndiv());
666         }
667         if (copyIfNull || source.getPmfmStratIsUniqueByTaxon() != null)
668         {
669             target.setPmfmStratIsUniqueByTaxon(source.getPmfmStratIsUniqueByTaxon());
670         }
671         if (copyIfNull || source.getUpdateDt() != null)
672         {
673             target.setUpdateDt(source.getUpdateDt());
674         }
675     }
676 
677     /**
678      * Gets the current <code>principal</code> if one has been set,
679      * otherwise returns <code>null</code>.
680      *
681      * @return the current principal
682      */
683     protected Principal getPrincipal()
684     {
685         return PrincipalStore.get();
686     }
687 
688     /**
689      * {@inheritDoc}
690      */
691     @Override
692     @SuppressWarnings({ "unchecked" })
693     public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search)
694     {
695         try
696         {
697             search.setPageNumber(pageNumber);
698             search.setPageSize(pageSize);
699             final PropertySearch propertySearch = new PropertySearch(
700                 this.getSession(), PmfmStrategyImpl.class, search);
701             final List results = propertySearch.executeAsList();
702             this.transformEntities(transform, results);
703             return new PaginationResult(results.toArray(new Object[results.size()]), propertySearch.getTotalCount());
704         }
705         catch (HibernateException ex)
706         {
707             throw ex; /*super.convertHibernateAccessException(ex);*/
708         }
709     }
710 
711     /**
712      * {@inheritDoc}
713      */
714     @Override
715     public PaginationResult search(final int pageNumber, final int pageSize, final Search search)
716     {
717         return this.search(PmfmStrategyDao.TRANSFORM_NONE, pageNumber, pageSize, search);
718     }
719 
720     /**
721      * {@inheritDoc}
722      */
723     @Override
724     public Set<?> search(final int transform, final Search search)
725     {
726         try
727         {
728             final PropertySearch propertySearch = new PropertySearch(
729                 this.getSession(), PmfmStrategyImpl.class, search);
730             final Set<?> results = propertySearch.executeAsSet();
731             this.transformEntities(transform, results);
732             return results;
733         }
734         catch (HibernateException ex)
735         {
736             throw ex; /*super.convertHibernateAccessException(ex);*/
737         }
738     }
739 
740     /**
741      * {@inheritDoc}
742      */
743     @Override
744     @SuppressWarnings("unchecked")
745     public Set<PmfmStrategy> search(final Search search)
746     {
747         return (Set<PmfmStrategy>) this.search(PmfmStrategyDao.TRANSFORM_NONE, search);
748     }
749 
750     /**
751      * Executes and returns the given Hibernate queryObject as a {@link PaginationResult} instance.
752      * @param queryObject
753      * @param transform
754      * @param pageNumber
755      * @param pageSize
756      * @return PaginationResult
757      */
758     @SuppressWarnings({ "unchecked" })
759     protected PaginationResult getPaginationResult(
760         final Query queryObject,
761         final int transform, int pageNumber, int pageSize)
762     {
763         try
764         {
765             final ScrollableResults scrollableResults = queryObject.scroll();
766             scrollableResults.last();
767             int totalCount = scrollableResults.getRowNumber();
768             totalCount = totalCount >= 0 ? totalCount + 1 : 0;
769             if (pageNumber > 0 && pageSize > 0)
770             {
771                 queryObject.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
772                 queryObject.setMaxResults(pageSize);
773             }
774             // Unchecked transformation because Set object is reused, cannot be strongly typed.
775             Set results = new LinkedHashSet(queryObject.list());
776             transformEntities(transform, results);
777             return new PaginationResult(results.toArray(new Object[results.size()]), totalCount);
778         }
779         catch (HibernateException ex)
780         {
781             throw ex; /*super.convertHibernateAccessException(ex);*/
782         }
783     }
784 
785     // spring-hibernate-dao-base merge-point
786 }