-->
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.  [ 2 posts ] 
Author Message
 Post subject: need help to understand many-to-one lazy and fetch
PostPosted: Thu Jul 21, 2005 9:55 pm 
Beginner
Beginner

Joined: Tue Apr 12, 2005 9:15 pm
Posts: 24
Hello,
I read the hibernate 3 docs, the migration guide, and the forum posts, but I am still not sure how many-to-one lazy=false, fetch=join, and at class lazy=true, proxy=proxyClass works together. Can someone who has understood all these explain how setting each of these in combination would work?

e.g: I have class A that has many-to-one on class B. When class A is loaded I want to load class B also. To do this, on many-to-one, should I be using lazy=false? Or should I use fetch=join?

With the introduction of lazy on many-to-one, what effect lazy=false would make when set for class B itself?

Do I need to specify proxy=proxyClass on class B? If I do have proxy=proxyClass defined on classB, what effect would I get?

I know a lot of it is explained in the docs, but for some reason, I am not able to have a clear understanding of this.


Top
 Profile  
 
 Post subject: Re: need help to understand many-to-one lazy and fetch
PostPosted: Fri Jul 22, 2005 4:08 pm 
Beginner
Beginner

Joined: Mon Apr 12, 2004 6:33 pm
Posts: 35
Partial answer:

I see no real use for lazy=true on a many-to-one. OK is saves you one join, but usually you want to init associated objects immediately.

If you set lazy=true on the class Hibernate uses lazy property fetching (see http://www.hibernate.org/hib_docs/v3/re ... properties). I suggest you do not use this unless you have a table with 100+ columns.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.