Hi,
I've read a couple of posts but I'm still confused.
I have 4 tables A, B, C and D (A has a set of Bs, B has a set of Cs and C has a set of Ds). All collections are bidirectionnal and marked as lazy="true".
I'm wondering how to get A (with B and C and D).
My idea was in one session to execute 3 HQL request :
- from A a left join fetch a.bs where ...
- from B b left join fetch b.cs where ...
- from C c left join fetch c.ds where ..
(Relations one to many are bidirectionnal that's why i can define the where clause)
These request work fine but I still need to initialize bs, cs and ds (in A, B and C).
I can use Hibernate.initialize(...) on all A for bs and on all B for cs ...
But one sql request is generated per Hibernate.initialize even if the objects of the collection are already loaded in the session.
What's the best way to get this graph ?
Is there a way to get this graph with a fixed number of sql statements ?
Thanks in advance
Francois[/b]
|