Quote:
I must do something seriously wrong or is it not possible to recieve large resultsets as list in Hibernate?
It is possible to handle large result sets in Hibernate. I regularly handle queries that return 100000+ entities. Hare are a few things that that you can try/check:
* Use Query.iterate() instead of Query.list(). This keeps the memory usage down if combined with regular calls to Session.clear() or Session.evict().
* Make sure that the JDBC driver knows how to handle large result sets. I use MySQL myself and the default setting in the JDBC driver is to download the entire result set in one go. This uses far too much memory. Don't know anything about Oracle...
* Make sure that you don't have any non-lazy associations or collections. This may result in additional queries for each result in the original result set. If you need to navigate an association later in the code, performance can be increased a lot by including a "fetch join" in the first query.
There are probably other things to do as well, but the three points above have all "bit" me in the past.