aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate: Copying or cloning criteria object for pagination Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate: Copying or cloning criteria object for pagination" Watch "Hibernate: Copying or cloning criteria object for pagination" New topic
Author

Hibernate: Copying or cloning criteria object for pagination

Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532

I am trying to implement pagination using Hibernate. I need to execute two criterias; one to return the rowCount and the other to execute the query itself.

I don't want to create two criteria objects, because it is redundant and some of my criteria are quite complicated with joins.

Is there any way to clone the criteria object?

On the hibernate forum, some suggests to use DetachedCriteria then Serialize and DeSerialize it; to me, it is very inefficient and slow.

I am using Hibernate 3.2

Thanks,

SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Hibernate: Copying or cloning criteria object for pagination