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: Join on multiple conditions
PostPosted: Fri Oct 16, 2009 4:42 am 
Newbie

Joined: Fri Oct 16, 2009 4:13 am
Posts: 1
Hello,

I wasn't able to find a good keyword for the search tool to help me on this issue.

My DB contains a user list, user groups (thus containing users), activities (linked to a user group), and a potential relation between users and activities.

Now, I want to select the list of all users concerned by an activity, with the properties coming this potential relation.

Thus I would use a left outer join, if doing it with plain old SQL:
Code:
    select .... FROM activity
    ... // different joins to link usergroup, user_usergroup and user tables
    inner join user_activity ua on user.id = ua.id_user and activity.id = ua.id_activity
    WHERE activity.id = 15


Now, I'm trying to use (N)Hibernate to do the job, and I found Criteria API very interesting. But I can't find a way to
generate this SQL query with multiple join fields:
" inner join user_activity ua on user.id = ua.id_user and activity.id = ua.id_activity "

The best solution I could create was with this link in the WHERE statement, and so broke the left outer join effect...

Do you know if it is possible with Criteria API ? Or Should I stick with SQL/HQL ?

Regards


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.