-->
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.  [ 4 posts ] 
Author Message
 Post subject: Control lazy initialization property
PostPosted: Mon May 12, 2008 7:23 am 
Newbie

Joined: Mon May 12, 2008 7:10 am
Posts: 1
Hi All,

All the mapping objects are specified by default as lazy=false in my hibernate association files. How to fetch only the parent object and to avoid associated child objects when the parent object is queried via code in DAO layer. Is there any property in hibernate to avoid immediate fetching during the query execution though the immediate fetching(ie lazy=false) is set in mapping file.
Please help ASAP.
Thanks in Advance..


Top
 Profile  
 
 Post subject: Re: Control lazy initialization property
PostPosted: Mon May 12, 2008 7:39 am 
Newbie

Joined: Mon May 12, 2008 12:22 am
Posts: 6
nethili@yahoo.com wrote:
Hi All,

All the mapping objects are specified by default as lazy=false in my hibernate association files. How to fetch only the parent object and to avoid associated child objects when the parent object is queried via code in DAO layer. Is there any property in hibernate to avoid immediate fetching during the query execution though the immediate fetching(ie lazy=false) is set in mapping file.
Please help ASAP.
Thanks in Advance..


the same content of my question:
http://forum.hibernate.org/viewtopic.ph ... highlight=


Hope we get an answer soon :)


Top
 Profile  
 
 Post subject: Re: Control lazy initialization property
PostPosted: Mon May 12, 2008 7:40 am 
Newbie

Joined: Mon May 12, 2008 12:22 am
Posts: 6
nethili@yahoo.com wrote:
Hi All,

All the mapping objects are specified by default as lazy=false in my hibernate association files. How to fetch only the parent object and to avoid associated child objects when the parent object is queried via code in DAO layer. Is there any property in hibernate to avoid immediate fetching during the query execution though the immediate fetching(ie lazy=false) is set in mapping file.
Please help ASAP.
Thanks in Advance..


the same content of my question:
http://forum.hibernate.org/viewtopic.ph ... highlight=


Hope we get an answer soon :)


Top
 Profile  
 
 Post subject: suggestion
PostPosted: Tue May 13, 2008 7:30 am 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
I think one way of doing it is the opposite of what you did:
1. make all your associations lazy=true
2. use 'fetch' in your HQL, e.g.
select mother from Cat as mother left join fetch mother.kittens


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