Hello :)
I am having the following problem:
I have an entity Student that has a ManyToOne relation to an entity City.
When I am executing a query (named or native) fetching all the Students (select student from Student student) Hibernate is executing a SQL query selecting all the Students (let's say I have 200 Students) and then it executes 200 queries selecting the Cities.
Something like:
Code:
select student0_.id as id104_, student0_.email as email104_, student0_.firstname as firstname104_ from STUDENT student0_
and the it executes 200 (the number of Students I have):
Code:
select city0_.id as id96_1_, city0_.name as name96_1_ from CITY city0_ where city0_.id=?
I feels that if it would execute it with a LEFT JOIN it would be more efficient.
I would like any input on that, because it is hugely affecting the performance.