-->
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: How to use query parameters for tuples?
PostPosted: Thu Jan 27, 2011 10:00 am 
Beginner
Beginner

Joined: Thu Feb 08, 2007 10:40 am
Posts: 46
Hi,

I have an HQL query that has a list of tuples in the where clause:
Code:
SELECT id FROM table t WHERE (t.col1, t.col2) in (('val1', 'val2'), ('val3', 'val4'), ('val5', 'val6'))

Now, I want to pass the values from the in part as parameters, so that the query would look something like this:
Code:
SELECT id FROM table t WHERE (t.col1, t.col2) in (:paramList)

How do I set the paramter list so that hibernate generates the correct SQL? I have tried query.setParameterList('paramList', array) with a two-dimensional array containing the values. But that did not work out. Hibernate just creates a flat list of parameters and the database consequently complains about a mismatch between operand and operator.

Is there a type for a tuple maybe? So that I could create a list of tuples and pass that to the setParameterList() method?


Top
 Profile  
 
 Post subject: Re: How to use query parameters for tuples?
PostPosted: Fri Jan 28, 2011 6:32 am 
Beginner
Beginner

Joined: Thu Feb 08, 2007 10:40 am
Posts: 46
Anyone?


Top
 Profile  
 
 Post subject: Re: How to use query parameters for tuples?
PostPosted: Wed Mar 16, 2011 6:04 am 
Newbie

Joined: Wed Mar 16, 2011 5:57 am
Posts: 1
I have the same problem. Anyone has an idea ?


Top
 Profile  
 
 Post subject: Re: How to use query parameters for tuples?
PostPosted: Mon Mar 17, 2014 7:36 am 
Newbie

Joined: Tue Dec 27, 2011 1:33 pm
Posts: 4
I have the same problem. any suggestions?


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.