Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top