Pregunta

Estaba tratando de hacer algo que aparentemente no funciona en JPQL:

JPQL:

select c from Car c
        left join fetch c.owner
        where c.type in (?1)
        order by c.model

Código:

public List<Car> findCarsFilterByTypes(CarType[] types) {
    return (List<Car>) this.entityManager.createNamedQuery("dealership.findCarsFilterByTypes")
            .setParameter(1, types).getResultList();
}

Esperaba que la ruta fácil de usar una matriz funcionara ... pero aparentemente no ... Obtengo una excepción inútil.

¿Alguien sabe cómo necesitaría obtener todos los autos que están en alguna lista de tipos de autos?

¿Fue útil?

Solución

Ok, descubrí que si uso List en lugar de CarType [], el código anterior funciona bien. :)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top