-->
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.  [ 3 posts ] 
Author Message
 Post subject: Using composite ids as named parameters
PostPosted: Tue May 09, 2006 4:56 pm 
Newbie

Joined: Tue May 09, 2006 12:04 pm
Posts: 2
I know that there have already been a lot of questions regarding this topic. I would like to replace a named parameter with a list of composite ids, resulting in something like

Code:
WHERE (CPR_ID, CPT_ID) IN ((1,2), (3,4), (5,6))


So I used a single parameter and setParameterList on the query

Code:
WHERE (CPR_ID, CPT_ID) IN (:filters)


This results in the following replacement (when called with an array of three elements):

Code:
WHERE (CPR_ID, CPT_ID) IN (?, ?, ?)


But nevertheless the query fails ("invalid relational operator").

After dozens of trys I do not know how to proceed. Is there any way to get composite identifiers working? And as far as I can see, there is no other way to yield the same result, or do I miss something?

Help is really appreciated.
Thanks in advance, Tilman


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 5:02 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
Code:
<composite-id name="myCompPK" class="MyCompositePK">
<key-property name="first"  column="FIRST" />
<key-property name="second" column="SECOND" />
<key-property name="third"  column="THIRD" />
</composite-id>


From MyObject obj Where obj.myCompPK in ( ? )

Will this work for you?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 5:49 pm 
Newbie

Joined: Tue May 09, 2006 12:04 pm
Posts: 2
This results in the same error message.

Besides, I partially use native SQL named queries, so referencing the composite key as a whole is not possible.

Tilman


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