I am having a problem with the setParameterList api parameter in sleep mode.
I am trying to pass a collection to SQLQuery and search in the "in" section. The records exist in the database and execute an unprocessed query, I can load them or if I just replace them in the same Hibernate SQL like emp.emp_name in ('Joe','John') , I can get the desired result set. I am confused by why Hibernate will not replace the collection instead of the named parameter. Here is the code:
session.createSQLQuery("select emp_id as id from emp where emp.emp_name in (:empNames)") .addScalar("id",Hibernate.INTEGER) .setParameterList("empNames",new String[]{"Joe","John"}) .list()
I looked at the Hibernate Documentation for setParameterList , but I can't reason about this particular behavior.
source share