Java Question

hibernate where clause any with collection as a named parameter query

I'm wondering if is possible to make this kind of evaluation with collections like the query isn't working in my project at a class named query as follow:

FROM Foo WHERE Id = :id AND (:barlist is null or Bar in (:barlist))

from this both post:

JPA where clause any

Hibernate HQL Query : How to set a Collection as a named parameter of a Query?

Answer Source

instead of in HQL you can check

    //query=FROM Foo WHERE Id = :id
   //query=FROM Foo WHERE Id = :id AND Bar in :barlist
   // query.setParameterList(:barlist",<list object>)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download