[jboss-user] [EJB 3.0] - Re: Passing array of enum to SELECT * WHERE clause

jefec do-not-reply at jboss.com
Wed May 23 03:30:29 EDT 2007


I'm using this solution:

public void get() {
	List types = new ArrayList();
	types.add(PersonType.DIRECTOR);
	types.add(PersonType.STUDENT);
	Query query = entityManager.createQuery("FROM Person p WHERE p.type IN (:types)")
       	.setParameter("types", types);	
	query.getResultList();
}

, where Person type is enum defined as :

public static enum PersonType {
	STUDENT,		
	DIRECTOR,
        ...
	}

What version of EJB do you have?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047801#4047801

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047801



More information about the jboss-user mailing list