-->
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.  [ 4 posts ] 
Author Message
 Post subject: Returning collection from report query
PostPosted: Tue Jul 20, 2004 10:34 am 
Newbie

Joined: Wed Feb 11, 2004 5:08 am
Posts: 14
Hi all,

I have a big class with multiple collections and other properties. Now I need to write a report query to efficiently return only the data I really need. Problem is that I haven't figured out any way how to return a collection from the report query.

For example I have class like this
Code:
class Test

Long id
String name
List list1
List list2
Set set1


and as a result of my report query I'd like to fill objects like this:
Code:
class TestInfo

Long id  // Here would be the id of the Test
String name  // Here would be the name of the Test
List list2  // Here would be the list2 of the Test


Now if I use a query like this
Code:
SELECT test.id, test.name, test.list2 FROM Test as test"

I get an error saying that elements() or indices() is expected.

When using elements() like this
Code:
SELECT test.id, test.name, elements(test.list2) FROM Test as test"

I don't get any errors and query is executed fine. Only problem is that I get multiple results for each Test instance I have in the DB because there is a new result for each item in list2. This means that I have to manually go though the results and create my TestInfo objects using hideous comparisons etc..

Is there any way I could write my query so that it would return me already initialized list and only as many results as I have Test instances in the DB?


Sincerely,

Jouni Hartikainen


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 10:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
no, no way to do this.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 10:43 am 
Newbie

Joined: Wed Feb 11, 2004 5:08 am
Posts: 14
gavin wrote:
no, no way to do this.


So the way I'm doing it at the moment is the best I could get?

-Jouni


Top
 Profile  
 
 Post subject: Any update to "Returning collection from report query&q
PostPosted: Thu Apr 05, 2007 1:47 pm 
Newbie

Joined: Thu Apr 05, 2007 1:39 pm
Posts: 1
I was wondering if there has been any updates to this issue since the original post in 2004 (i.e. can reports queries now return a collection).

Thanks,

Keith


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.