EJB QL: Passing array of enum to SELECT * WHERE a IN () clause
Hello,
I am trying to pass an array of enum to EJB QL as followed:
em.createQuery("FROM OrderInfo o WHERE o.ordStatus IN (:ordStatus)")
.setParameter("ordStatus", ordStatsStr)
Note that o.ordStatus is of type enum OrderStatus.
I've tried to set "ordStatus" as String (i.e. 'OPEN', 'CLOSED'), as well as an array of enum but EJB QL would not parse them (perhaps for a good reason). EJB QL (I use JBoss + Hibernate) threw the following exception (or similar depending on whether I passed in an array of enum or a String):
org.hibernate.TypeMismatchException: named parameter [ordStatus] not of expected type;
expected =class ....OrderStatus; but was =java.lang.String
Can someone show me the way to set the IN clause with an array of enum?
Thanks

