Is there a way to combine streaming data retrieval with hibernate?
Posted
by Steve B.
on Stack Overflow
See other posts from Stack Overflow
or by Steve B.
Published on 2010-03-11T20:25:36Z
Indexed on
2010/03/11
20:29 UTC
Read the original article
Hit count: 240
For the purposes of handling very large collections (and by very large I just mean "likely to throw OutOfMemory exception"), it seems problematic to use Hibernate because normally collection retrieval is done in a block, i.e. List values=session.createQuery("from X").list(), where you monolithically grab all N-million values and then process them.
What I'd prefer to do is to retrieve the values as an iterator so that I grab 1000 or so (or whatever's a reasonable page size) at a time. Apart from writing my own iteration (which seems like it's likely to be re-inventing the wheel) is there a hibernate-native way to handle this?
© Stack Overflow or respective owner