[jboss-user] [EJB 3.0] - Passing array of enum to SELECT * WHERE clause
tonylmai
do-not-reply at jboss.com
Tue May 22 20:37:35 EDT 2007
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 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):
anonymous wrote : 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
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047747#4047747
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047747
More information about the jboss-user
mailing list