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