-->
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: Problem with the lazy attrubute and FetchMode EAGER
PostPosted: Sun Feb 06, 2005 10:08 am 
Newbie

Joined: Wed Jan 26, 2005 8:05 am
Posts: 13
Hi guys,
I have a User parent class which has a Set of UserAccessRights objects.
I want to dynamically change the way I load the User with or without
the Set of UserAccessRights objects initialized.
So I set the lazy attribute in the User mapping xml file to true as below.

Mapping documents:
<set name="userAccessRightSet" lazy="true" table="user_access_rights" cascade="save-update">
<key column="user_id"/>
<composite-element class="com.UserAccessRights">
<parent name="User"/>
<property name="role" column="user_role" type="integer"/>
<many-to-one name="fileBusinessEntity" class="com.FileBusinessEntity" column="file_id" not-null="true" cascade="none"/>
</composite-element>
</set>


Note: the UserAccessRights class is mapped as Composite-Element.
In my code I load the User as below:

Code between sessionFactory.openSession() and session.close():
Criteria crit = session.createCriteria(User.class);
crit.add(Expression.eq("userId",userId));
crit.setFetchMode("userAccessRightSet",FetchMode.EAGER);
user = (User) crit.uniqueResult();

I use the EAGER FetchMode.
The problem is that the FetchMode.EAGER does not override the lazy attribute in the User mapping xml file and the UserAccessRights Set is not initialized.

So where the problem could be ?
How could I override dynamically the lazy attribute in the mapping xml file ?
Am I missing something ?

Thank you.

Skyrose.

Hibernate version: 2.1


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 5:06 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
post this to JIRA please

_________________
Emmanuel


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.