My Problem is as follows
@Entity
public class MainType{
@Fetch(FetchMode.JOIN)
@ManyToOne(fetch = FetchType.EAGER)
private SubType subObject;
}
@Entity
public class SubType{
@Fetch(FetchMode.JOIN)
@ManyToOne(fetch = FetchType.EAGER)
private SubSubType subsubObject;
}
When I query the MainType with Hibernate to recieve a Collection hibernate will make a join. Something like
select * from MainType left join SubType
which is good but then it makes another select for each record that the first query returned to load SubSubType. I would like to load everything in a single query like select * from MainType left join SubType left join SubSubType
.
Do you know any way to make that happen?