-->
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: Collapsing a theta-style join
PostPosted: Wed Mar 17, 2004 8:48 am 
Newbie

Joined: Tue Aug 26, 2003 9:45 am
Posts: 17
Location: Toronto, Canada
I am currently using a theta style join to do a query between two classes which don't have a mapped relationship (for Hibernate). I am wondering if there is any way to get Hibernate to collapse the result, which in this case will consist of the same object as the first array element in every returned row. So I do this:

select user, ur.roleName from User user, UserRole ur where user.username=ur.username and user.id = :id

Now for a user object having x roles, what I will get back is a list of length x of Object arrays, basically each array consisting of the same user object in element 0, and one role in element 1.

Can anybody think of how I can restructure my query to collaps the results, so I only get back one copy of the user object and all the roles? My feeling is it can't be done (I don't know how the result would even be structured, in raw AQL at least), but I just wanted to see if any Hibernate/SQL gurus have any ideas...

Regards,
Colin


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 8:53 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Projection (your select clause) generates a collection of object arrays, nothing can be done about that having duplicates, just as in SQL.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.