-->
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: Lazy Question
PostPosted: Thu Jun 16, 2005 7:01 am 
Newbie

Joined: Fri Mar 18, 2005 5:35 am
Posts: 8
Hi, probally this a stupid question, but i don't found docs regarding this...
For example if i have three class A,B and C and A have a 1-n relation to B and n-n relation to C (A have to methods: getBs and getCs mapping as set with lazy attribute to true)

for load A instance without B and C (related to the particular a instance)
i use: session.load(A.class,aId);

for load A instance with B (or C) i use:
A a = (A) session.load(A.class,aId);
Hibernate.initialize(a.getBs);

for load all i use:
A a = (A) session.load(A.class,aId);
Hibernate.initialize(a.getBs);
Hibernate.initialize(a.getCs);

But if i B have a relation 1-n to D class and i would load the D class when load B for A (D are lazy loaded) how realize it?It's possible?

If i would load all a with B and C is possible using a only query or i should iterate on collection like this:
(select atmp from A as atmp) return a collection
....
while(collIT.hasNext()){
a = (A) collIT.next();
Hibernate.initialize(a.getBs);
Hibernate.initialize(a.getCs);
}
...
Thanks in advance.
Alessio


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 10:06 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Read the docs again, look for key word fetch.

http://www.hibernate.org/hib_docs/v3/re ... -outerjoin

http://www.hibernate.org/hib_docs/v3/re ... e-fetching


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 10:45 am 
Newbie

Joined: Fri Mar 18, 2005 5:35 am
Posts: 8
Thank's for answer...i read the docs better ;)


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.