-->
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: HQL. Help SubQuery in many-to-many
PostPosted: Fri Jan 30, 2004 2:29 pm 
Newbie

Joined: Fri Sep 19, 2003 2:57 pm
Posts: 10
I have to classes:
user with usrId as a key. Table users
userGroup with usgId as a key. Table user_groups

I have a many-to-many relationship between them using other table user_group_details with both keys.

I want to make a query to select the userGroups with the id of the user.

I have this:
select elements(user.userGroups)
from com.miradores.vmon.data.UserGroup as usergroup
,com.miradores.vmon.data.User as user
where 1=1
and usergroup in elements(user.userGroups)
and user.usrId = 1

But doesn't work!

How must be the query?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 30, 2004 7:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
"from UserGroup u join u.users user where user.id = 1" ?


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.