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.  [ 3 posts ] 
Author Message
 Post subject: In operator problem
PostPosted: Mon Apr 13, 2009 12:41 am 
Newbie

Joined: Mon Apr 13, 2009 12:36 am
Posts: 4
I have a Project entity which has many-to-many property Users. I would like to query all projects which have a concrete user at their Users collection. Something like this:
from Projects p where :user in p.Users

How can I do it using NHibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 13, 2009 3:38 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Try this:

Code:
from Projects p where :user in elements(p.Users)

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 13, 2009 10:56 pm 
Newbie

Joined: Mon Apr 13, 2009 12:36 am
Posts: 4
wolli, thank you very much! Your solution helped to solve my problem :)


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