-->
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: CollectionOfElements in query
PostPosted: Tue May 18, 2010 2:06 pm 
Newbie

Joined: Tue May 18, 2010 1:56 pm
Posts: 1
I'm blown away by how much time I've wasted on this and I'm not any closer to a solution...I know I'm doing something really stupid. Here is my query:

SELECT carrier FROM Carrier carrier WHERE carrier.owningEnterprise.HID IN (?1) AND carrier.services IN (?2)

carrier.services is a CollectionOfElements (String), and I'm binding an ArrayList<String> to the 2nd parameter. I end up blowing up with the following sql error msg:

WARN - SQL Error: 17041, SQLState: null
ERROR - Missing IN or OUT parameter at index:: 2


All I'm trying to do is query a carrier object that has any (an 'or' search) of the services the user selects. What am I missing? Thanks for the help!


Top
 Profile  
 
 Post subject: Re: CollectionOfElements in query
PostPosted: Tue May 18, 2010 5:11 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
the syntax you use to define parameters is wrong:
use either
Code:
SELECT carrier FROM Carrier carrier WHERE carrier.owningEnterprise.HID IN (?) AND carrier.services IN (?)

or
Code:
SELECT carrier FROM Carrier carrier WHERE carrier.owningEnterprise.HID IN (:first) AND carrier.services IN (:second)

BTW you might want to use Hibernate Search to search on String collections, way better performance and flexible matching.

_________________
Sanne
http://in.relation.to/


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.