0 Replies Latest reply on May 22, 2007 8:26 PM by tonylmai

    Passing array of enum to SELECT * WHERE clause

      Hello,

      I am trying to pass an array of enum to EJB EL 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 Hibernate would not parse them (perhaps for a good reason). 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 in Hibernate?

      Thanks