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
|