-->
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 Feb 24, 2006 6:14 am 
Newbie

Joined: Fri Oct 28, 2005 9:08 am
Posts: 12
I have a Usrgsm class and a Suscrb class with a many-to-one association.
When I want to load the Suscrb entity, I want to load all the properties without the Usrgsm associated with the many-to-one relationship. I have used the three option for the lazy option in the many-to-one tag (lazy=proxy, lazy=no-proxy and lazy=false) but the Usrgsm is always loaded.

Here are the mapping files. I use Hibernate 3.1.

<hibernate-mapping package="com.cwsoft.model.businessobject">

<class name="Suscrb" table="SUSCRB" lazy="false">
<id name="id" column="ID" type="long">
<generator class="assigned"/>
</id>
<many-to-one name="usrgsm" column="ID_UG" class="Usrgsm" lazy="proxy"/>
<property name="refmaj" column="REFMAJ" type="string"/>
<property name="susnum" column="SUSNUM" type="long"/>
<property name="operator" column="OPERATOR" type="string"/>
</class>

</hibernate-mapping>

<hibernate-mapping package="com.cwsoft.model.businessobject">

<class name="Usrgsm" table="USRGSM" lazy="false">
<id name="id" column="ID" type="long">
<generator class="assigned"/>
</id>
<property name="datcrt" column="DATCRT" type="string" />
<property name="name" column="NAME" type="string" />
<property name="firstname" column="FIRSTNAME" type="string" />
</class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 7:07 am 
Regular
Regular

Joined: Wed Feb 08, 2006 3:59 pm
Posts: 75
Try to remove the lazy="false" attribute to your Suscrb class. As far as I can remember, non lazy classes can't use lazy many-to-one (no CGLIB instrumentation).


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.