JPQL test if value is in an array

java, jpa, jpql, orm

Solution

Ok I found that if I use List instead of CarType[], the code above works just fine. :)

Problem

I was trying to do something that apparently doesn't work in JPQL: JPQL: ``` select c from Car c left join fetch c.owner where c.type in (?1) order by c.model ``` Code: ``` public List<Car> findCarsFilterByTypes(CarType[] types) { return (List<Car>) this.entityManager.createNamedQuery("dealership.findCarsFilterByTypes") .setParameter(1, types).getResultList(); } ``` I was hoping the easy route of using an array would work... but it apparently doesn't... I'm getting a useless exception. Anyone knows how I'd need to go about getting all the cars that are in some list of car types?

Original source