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?