Jpa parameter list for 'IN' clause + eclipse link

View: New views
2 Messages — Rating Filter:   Alert me  

Jpa parameter list for 'IN' clause + eclipse link

by Pradeep Agrawal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi , could somebody please help me with this?

i have my named native query in orm.xml . which has a condion as follows
  AND PREV.event_cd IN (?invalidECodeList)

from my java code i am setting the above parameter with list

  List<String> invalidECodeList = new Vector<String>();
        invalidECodeList.add("37");
        invalidECodeList.add("15");
        query.setParameter("invalidECodeList", invalidECodeList);


It runs fine but gives me wrong result
;

 though if i put the parameter directly in the query like
AND PREV.event_cd IN (37,15)
it runs fine and gives correct result.

Could somebody plz help me with this, i tried so many ways to pass a list, array of object/strings/int , but nothing works.
Note: I am using eclipselink

Re: Jpa parameter list for 'IN' clause + eclipse link

by James Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Turn logging on and include the SQL and parameters that are logged.

My guess is your event_cd is a number not a String, so binding the Strings will not work, you need to put Integers into the collection.