I need to use an IN clause like the following SQL
SELECT * FROM tableA WHERE colA in (1, 2,3)
How can i do this in EJBQL?
i’ve tryed the following, which obviously failed:
SELECT tab FROM tableA tab WHERE tab.colA in (:colValues)
then in java i did
query.setParameter("colValues","1,2,3")
that gives me the following exception
org.apache.openjpa.lib.jdbc.ReportingSQLException: ORA-01722: invalid number
The problem is when you use
:parameter_namein an sql fragment and then callquery. setParamter("parameter_name", values)it is expected thatvaluesshould be some sort ofcollection. Try this.