java - If I call size() on a lazy collection, will Hibernate fetch it? -
this question has answer here:
when use 1 many relational mapping hibernate (say 1 house, many windows) , call method house.getwindows().size(), hibernate smart enough invoke select count? or, alternatively, fetch rows window table mapped row in house table?
counting children iteration may highly inefficient, lots of data windows fetched without need. size() equally bad? , size() work @ if result set limit configured somewhere?
the collection initialized in case size() called can changed additional annotations.
if want select count query executed need specify additional annotations or xml attributes.
refer this discussion exact details.
Comments
Post a Comment