Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate: Copying or cloning criteria object for pagination

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic