-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Pagination on Criteria
PostPosted: Mon Mar 07, 2005 7:44 am 
Newbie

Joined: Mon Mar 07, 2005 7:25 am
Posts: 10
We are working on a Hibernate proof of concept for a very large (140 tables, 160 million records) project, but I'm having a few problems with the Criteria specification. I'm using Hibernate 3.0 beta 4 b and an Oracle 9 database.

I'm trying out the pagination support on Criteria (we would to see composition in our queries), but:

- If I run a named SQL query (something trivial like a "select ...") and specify setFirstResult() or setFetchSize() on that, Hibernate works as expected and puts something like this:
Code:
select * from ( select row_.*, rownum rownum_ from ( SELECT ... ) row_ where rownum <= ?) where rownum_ > ?

around my SELECT query.

- If I try the same thing (setFirstResult, setFetchSize) with the Criteria framework, it doesn't add anything to the generated SQL, which kills the JVM (OutOfMemoryError) because of the large resultset. Oddly enough, criterions (eg. Restrictions) do seem to work. The pagination support is also not present in the DetachedCriteria, but that's a derivative problem.

Possible detail (don't think it matters): I'm using a sessionFactory created from Spring, patched for Hibernate 3 support.

Since we are trying really hard to get Hibernate accepted for this project (currently iBatis :-\ ), any help solving this deal breaker would be nice.

Regards,
Thomas Goorden


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 07, 2005 7:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Show your code - I am pretty sure setMaxResults/setFirstResult does work on Criteria queries.


Top
 Profile  
 
 Post subject: Solved
PostPosted: Mon Mar 07, 2005 8:19 am 
Newbie

Joined: Mon Mar 07, 2005 7:25 am
Posts: 10
You're quite right, it was an error on my part. setMaxResults does the trick.

Is there a reason DetachedCriterio hasn't been "completed" (meaning it mirrors all of the Criteria functions)?

Thomas


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.