When I try to do entity.getRelations( ) on the <set> hibernate issues n+1 selects for each entity in the relation.
I can clearly see that it happens because of <many-to-one> properties mapped as lazy="false".
If i take off lazy="false" with fetch='join' then there is just 1 select and it initializes the complete set BUT with proxies. Which are soon needed and
hence more selects coming back to same n+1 problem
I am looking to eager fetch all the entities(elements) of a set for a given entity.
Something like: "from entity e left join fetch e.relationOrderSet ros where e.id = :id"
If i don't put the 'where' clause all the entities with all the relations gets loaded and that would be a nightmare with millions of entities.
If i put the where clause then Hibernate issues n + 1 selects. (for the above mapping)
I want to batch-select only the entities within the set (with No Proxies) for a given entity