-->
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: How to fetch a Collection in a tuple?
PostPosted: Wed Mar 01, 2006 8:33 am 
Newbie

Joined: Sun Feb 06, 2005 11:46 am
Posts: 4
Location: Rotterdam, Netherlands
Hi,

I want to fetch 2 classes that have no directly mapped relation. I want to get them as Object[], where object[0] is the first class, and object[1] is a collection of all elements of the second class.

Imagine that I have a Poll that has several Questions. Each Visitor can give an Answer to every Question in a Poll. Now I want something like this:

select visitor, answer from Visitor visitor, Answer answer .....

The problem here is that I get a result for every answer of every visitor. Instead I want only individual Visitors and all answers grouped together in a Collection.

Does anybody know if this is possible and if so, how to do this?

Regards, Jeroen


Top
 Profile  
 
 Post subject: impossible(almost)
PostPosted: Wed Mar 01, 2006 11:59 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Hibernate HQL does not support arbitrary joins, you need to use native SQL support to do what you want
http://www.hibernate.org/hib_docs/v3/re ... rysql.html

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.