-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: graph loading
PostPosted: Mon Feb 07, 2005 10:59 am 
Newbie

Joined: Mon Feb 07, 2005 10:26 am
Posts: 9
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]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 4:57 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
batch-size

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 6:06 am 
Newbie

Joined: Mon Feb 07, 2005 10:26 am
Posts: 9
Thanks for your reply emmanuel,

I already use batch-size but with this method the number of sql statement is not fixed.

Is there a way to avoid calling Hibernate.intialize (sql statement) to initialize the lazy collection when all objects in this collection are already in the session ?

No way to get this graph with a fixed number of sql statements ?

Thanks in advance
Francois


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.