wood burning stoves*
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate: Copying or cloning criteria object for pagination