-->
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: Query to include only objects with one to many reference
PostPosted: Thu Jun 26, 2008 9:11 am 
Newbie

Joined: Wed May 07, 2008 4:39 am
Posts: 3
I have two Objects: Country & Site

The database contains all the world's countries. A Site object refer to one and only country.

I want to retrieve the list of Country objects that has a Site attached to them. So exclude all others countries that are not "used" by a site.

How can I achieve that with the nHibernate Criterias API ?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 29, 2008 9:19 pm 
Newbie

Joined: Sun Jun 29, 2008 3:14 pm
Posts: 6
Maybe something like

Code:
ICriteria crit = session.CreateCriteria(typeof(Country));
critQuery.Add(Expression.IsNotEmpty("Site"));


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.