-->
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.  [ 5 posts ] 
Author Message
 Post subject: many to one property loaded although it is lazy
PostPosted: Fri Oct 21, 2005 9:56 am 
Beginner
Beginner

Joined: Tue May 10, 2005 4:18 am
Posts: 29
Hello All
I have this mapped property in my object:
Code:
   <many-to-one name="mainSpatialObject" class="SpatialObject" column="idgis" lazy="true" property-ref="gisID"/>


As you can see it is lazy.

However- when I perform a simple "session.get() " on the object, I can see an SQL statement generated for the "mainSpatialObject".

Why isn't it lazy ?

Thank you !


Top
 Profile  
 
 Post subject: Re: many to one property loaded although it is lazy
PostPosted: Fri Oct 21, 2005 10:14 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
What version of Hibernate are you using. lazy="true" isn't a valid option for many-to-one from 3.0.5 going forward.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject: Hibernate version
PostPosted: Fri Oct 21, 2005 10:51 am 
Beginner
Beginner

Joined: Tue May 10, 2005 4:18 am
Posts: 29
I am using version 3.0.3.
The options to use are "proxy, true, false".
If I want the many-to-one property to be fetched only when a "get" method is called upon this property - shouldn't I use true ?


Top
 Profile  
 
 Post subject: many-to-one
PostPosted: Fri Oct 21, 2005 11:23 am 
Beginner
Beginner

Joined: Tue May 10, 2005 4:18 am
Posts: 29
Ok, an Update.
I removed the lazy property :
Code:
<many-to-one name="mainSpatialObject" class="SpatialObject" column="idgis" lazy="proxy" property-ref="gisID"/>


But still the SQL statement for the property is made.
BUT -
I have another many-to-one property in this object
Code:
<many-to-one name="mainImage" class="Image" column="main_image"/>


And when I removed the ' lazy="true" ' for this one - no SQL statement are generated for it anymore.

What could be the difference between this 2 , that the first cuases Hibernate to generate an SQL statment, and the second doesnt ?

Thank you!


Top
 Profile  
 
 Post subject: solved
PostPosted: Fri Oct 21, 2005 11:44 am 
Beginner
Beginner

Joined: Tue May 10, 2005 4:18 am
Posts: 29
Ok - answering myself :
the "property-ref" is the problem:
http://forum.hibernate.org/viewtopic.ph ... tyref+lazy

However - I cannot avoid it. At least I know why.

Thanks anyhow :-)


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