I have the following entities:
@Entity
class A{
@OneToMany
private List<B> bs;
...
}
@Entity
class B{
@OneToMany
private List<C> cs;
...
}
@Entity
class C{
...
}
So I do the followin query:
SELECT a FROM A a LEFT JOIN FETCH a.bs b LEFT JOIN b.cs
This code works, the only problem that A and B are read from database in one join query, but for reading C (LEFT JOIN b.cs) separate sql query is executed to read only C entities. How to read A,B,C in one sql query.