-->
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: How to do theta-style outer join or use mapped-SQL equiv
PostPosted: Fri Apr 23, 2004 4:40 pm 
Newbie

Joined: Tue Aug 26, 2003 9:45 am
Posts: 17
Location: Toronto, Canada
I seem to be stuck between a rock and hard place. I currently have two unrelated (as far as Hibernate is concerned) tables, users, and user_role, and am using the following HQL query for a theta-style join:

select distinct user, ur.roleName from User user, UserRole ur where user.username=ur.username

This works fine except it's an inner join, and I want to return users even if they have no roles. So in SQL this would would trivial to do as a left outer join, but as far as I can tell HQL doesn't support theta-style outer joins.

I also appear to be unable to do this using a
named <sql-query> element, as that expects to only return one class, and I also need the roles.

Do I have no choice here other than introducing a Hibernate relation?

Regards,
Colin


Top
 Profile  
 
 Post subject: outer or full join must be followed by path expression
PostPosted: Fri Aug 08, 2008 10:23 am 
Newbie

Joined: Fri Aug 08, 2008 9:38 am
Posts: 3
I am also facing similar situation.

I have two tables A & B, not related w.r.t. hibernate. I want List of Object[] where
Code:
Object[0] = A and Object[1]=B.


Would work fine for inner join as:
Code:
"select a,b from A a, B b where a.col1=b.col2".

But, seems outer join(left/right/full) are not allowed.


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.