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.  [ 6 posts ] 
Author Message
 Post subject: lazy="false" in class mappings
PostPosted: Wed Jan 31, 2007 10:02 am 
Newbie

Joined: Wed Jan 31, 2007 9:37 am
Posts: 2
Location: Uruguay
Hi,

If I use lazy="false" in class mappings (<class name="com.xxx.xxx" table="xxxx" lazy="false">), can I overrite it when mapping associations to this class or with criteria queries and Fetch Modes? Because the documentation (in chapter 5.1.3. class) says: "lazy (optional): Lazy fetching may be completely disabled by setting lazy="false".

Hibernate version: 3.0

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 31, 2007 11:25 am 
Beginner
Beginner

Joined: Thu Sep 22, 2005 10:48 am
Posts: 30
Location: Rio de Janeiro, Brazil
Criteria
Code:
.setFetchMode("yourcolection", FetchMode.JOIN)


HQL
Code:
from YourDomainClass left fetch join yourcolection

_________________
Please don't forget to rateME!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 31, 2007 11:35 am 
Newbie

Joined: Wed Jan 31, 2007 9:37 am
Posts: 2
Location: Uruguay
passos wrote:
Criteria
Code:
.setFetchMode("yourcolection", FetchMode.JOIN)


HQL
Code:
from YourDomainClass left fetch join yourcolection


Yes, but I don not want to load the asociation, I want it to be lazy. For example I have a User class with a many-to-one asocition to Group class which has <class lazy="false" ....>, so when a search a User with a criteria I do not want to load the group.
It seems that you cannot override the lazy value if put <class lazy="false" ....>

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 31, 2007 11:35 am 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
You can also use:

Hibernate.initialize()

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 1:30 pm 
Newbie

Joined: Thu Feb 08, 2007 1:24 pm
Posts: 1
fefo22 wrote:
Yes, but I don not want to load the asociation, I want it to be lazy. For example I have a User class with a many-to-one asocition to Group class which has <class lazy="false" ....>, so when a search a User with a criteria I do not want to load the group.
It seems that you cannot override the lazy value if put <class lazy="false" ....>

Thanks


I am having this same problem, was a solution ever found for this?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 1:44 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
If you disable proxy generation for a class, you can only lazy load associations to that class with interception through bytecode enhancement.

http://www.hibernate.org/315.html

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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