-->
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: How to control the subselect
PostPosted: Mon Dec 24, 2007 2:26 am 
Newbie

Joined: Mon Dec 24, 2007 2:04 am
Posts: 6
Hi guys,
I am quite new with NHibernate.
Let's take a look at the following example:
I have Customers and each Customer has a collection of Orders (Lazy=true, fetch=subselect).
Now let say that i would like to retrieve all the Customers under the age of 50. This would not be a problem since i can achive that via expresions or HQL.
But what if i want to retrieve all the customers under the age of 50, and for each of these customers i would like to get only the orders that were created before the 01/01/2000... can i do that?
Note: i don't want to retrive 2 differnt arrays of Customers and Orders, i would like to retrieve a filtered list of Customers and each Customer with its filtered collection of Orders.

Best regards


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 27, 2007 7:31 pm 
Beginner
Beginner

Joined: Wed Jul 11, 2007 7:21 pm
Posts: 21
Location: San Diego, CA
If you know how to pull back the customers under age 50 in hql, tacking this onto your Where clause seems simple enough " AND Order.OrderDate > '01/01/2000' "

_________________
http://rebelheart.squarespace.com


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.