-->
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: JPQL: looking up in several list fields
PostPosted: Thu Jan 28, 2010 2:16 pm 
Newbie

Joined: Thu Jan 28, 2010 1:39 pm
Posts: 1
Hi,

It seems simple but I'm not able to build a query that properly describes the following case:

- The class UserGroup has a list of users (UG.users)
- The class C has a list of users (C.users)
- The class C has a list of UserGroup (C.usersgroups)

My goal is to build a query that returns all classes "C" that contain a specific user through the lists "C.users" or "C.usersgroups.users". I am trying it by using the following JPQL query.

SELECT C FROM table_x C, IN(C.users) U1, IN(C.usersgroups) UG, IN(UG.users) U2 WHERE (U1 = :iduser) OR (U2 = :iduser)

This is not returning any row when it is supposed to return one row.

Any ideas?

Best Regards,

Anthony


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.