setParameterList « HQL « JPA Q&A





1. Optional parameter with setParameterList in HQL    stackoverflow.com

I have a query with optional parameter

"SELECT ClinicId,Name from Clinic where :ClinicIds is NULL OR ClinicId IN :ClinicIds"

List<int> ClinicIds = null;
I'm passing the parameter as following
q.SetParameterList("ClinicIds", ClinicIds);
Because ClinicId is an optional ...

2. Problem with HQL setParameterList()    forum.hibernate.org

Hi I couldn't obtain any result from HQL, but I could do it with SQL this the hbm.xml select st from Nstock st where st.remito in (:pRemitos) and the java code public static Query getSerialsDataByRemitos(List remitos) throws Exception { Session hSession = HibernateSession.currentSession(); Query qSerials=hSession.getNamedQuery("reportSerialsByRemitos"); qSerials.setParameterList("pRemitos",remitos); //HibernateSession.closeSession(); qSerials.setCacheable(true); return qSerials; } and true returns this sql statement ...

3. trouble using the setParameterList in HQL    forum.hibernate.org