difference between query.list and query.iterate
hibernate, java
Solution
If instances are already in the session (primary-level cache) or second-level cache `iterate()` will give better performance.
If they are not already cached, `iterate()` will be slower than `list()` and might require many database hits for a simple query.
Problem
What exactly is the difference between using `Query.list()` and `Query.iterator()`? Is there is any performance enhancement in using either. I mean that is any of them implementing lazy loading ? Or is Query.iterator() ultimately same as `query.list().iterate()` Also why is there no `Criteria.iterator()` only `Criteria.list()`