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: NamedQuery and list elements to where clause in hashmap
PostPosted: Thu Jul 29, 2010 2:51 pm 
Newbie

Joined: Thu Jul 29, 2010 2:38 pm
Posts: 1
Hi, i have a problem with a query. I need compare a List of String in the WHERE IN clause but i dont have results:


I have this code in java:
....
String[] codes = {"CODE_A", "CODE_B"};
HashMap whereClause = new HashMap();
whereClause.put("codes", codes);
List result = getObjectPersisterService()
.executeNamedQuery("findDataUsingNamedQuery", whereClause);

In my namedQuery.xml file i have:

<query name="findDataUsingNamedQuery">
<![CDATA[
SELECT
company
FROM
net.model.company AS company LEFT JOIN company.credential AS credential
WHERE credential.code IN (:code)
]]>
Any sugestions?

Thanks!
This query works fine if i have one string: String codes = "CODE_A";
or if i use in the WHERE clause this: WHERE credential.code IN ('CODE_A', 'CODE_B')


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.