-->
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: Why are many-to-one associations not lazy?
PostPosted: Fri Nov 11, 2005 2:34 pm 
Newbie

Joined: Sat May 21, 2005 8:02 am
Posts: 6
Hi. I'm using hibernate 3.0.5. I have a question that relates to hibernate's architecture:
Why are many-to-one associations never lazy?

One of my classes has a many-to-one association. Hibernate creates a proxy. When I
call a method of the proxy, hibernate reads the object from the database (which is fine),
but each object that is associated with a many-to-one or one-to-one association, too!
I'd have expected hibernate would generate proxies.

Code inspection showed that right at the start the Configuration object reads my
config file. It calls the constructor "ManyToOneType (String name)", which sets lazy
to false. This basically is the reason why many-to-one assocs are never lazy.

But what is the sense? Why is it not possible to configure hibernate in a way the
constructor "ManyToOneType (String name, boolean lazy)" is called with
"lazy == true"?

Am I missing something?

This behaviour makes parts of my application slow, so this is a crucial problem for me.
Please help me in understanding this task.

Thanks in advance.
Erik


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 5:14 pm 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Please show your mapping and hibernate.cfg.xml.

HTH
Ernst


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.