-->
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.  [ 1 post ] 
Author Message
 Post subject: SELECT NEW() with a collection inside the constructor HQL
PostPosted: Wed Dec 15, 2010 4:36 am 
Newbie

Joined: Wed Dec 15, 2010 4:33 am
Posts: 1
Hi all, I don't seem to find an answer to somthing that i refuse to accept as "Not Possible" :)

Here is my HQL query: "SELECT new TestTable(t.id,t.param1,t.param2,t.param3,stps) FROM TestTable t left join t.steps as stps WHERE t.someObj.id IN (:someObjIds)"

TestTable has the following consturtor: public TestTable(Integer param1, Integer param2,Date param3,Date param4, Set steps)

i have tried to use Collection in constructor instead of a Set but it didn't work, the constructor will receive only the first item out of the collection as a parameter and not the entire collection as i expected.

in the query i also tried to use left join fetch t.steps, tried without left join at all, tried to surround the "stps" parameter in the constructor with "elements" like this: elements(stps)

but nothing worked... the reason i'm doing this is because TestTable is very big and has a lot of columns and assosiations but in this case i want only 4 columns and one collection. when one query can return up to 400,000 objects this becomes nenecessary.

any ideas anyone??? (btw, my name is Tomer)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.