I checked Hibernate's doc :
http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html#o...
Basically Query.list() will do one query, Query.iterate() will do n+1 queries except if
entities whose identifier are returned are already cached. In Query.list() and
Query.iterate(), you get lazily loaded proxies, meaning Hibernate has the data (from the
initial query) but the object's fields are not filled yet. This is just a reflection
optimisation, not a querying one.
Obviously there's a performance tradeoff here : you're trading queries number vs
result set size. IMO the overhead cost of each query is so high that you'd rather go
with a single query.
Anymay, in the forum module most of the methods using Query.iterate() are returning a
list. A better solution is as simple as
return query.list();
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974761#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...