-->
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.  [ 1 post ] 
Author Message
 Post subject: How to change many-to-one associations lazy setting?
PostPosted: Mon Apr 18, 2011 7:56 am 
Regular
Regular

Joined: Tue Apr 10, 2007 10:02 am
Posts: 56
I'm using a generics based DAO tier design that employs the same implementation DAO class for all domain objects. I have a question about whether its possible to turn off many-to-one fetch settings as part of HQL query?

For example...
Code:
   class Customer {
   }

   class Invoice {
       private Customer Customer;
   }

When I'm retrieving a single invoice instance I want the hibernate process to load the customer class property. To force this I've set the Hibernate mapping for the Customer property to be lazy="false". However, if I'm loading all invoices for a given customer then I don't want the DAO process to load the customer class property for each invoice.

Is there a HQL query option to stop the invoice customer property being loaded? I could use a select field list to restrict the fields being returned, but is there anything smarter available?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.