Reputation: 597
I am trying to write the below JPQL query .
List<Person> personList = query
.from(person)
.innerJoin(person.address, address)
.where(address.status.eq("active")
.fetch();
Below is the exception thrown after executing the above lines:
nested exception is java.lang.IllegalArgumentException: Parameter value [select person
from Person person
inner join person.address as address
where address.status = ?1] did not match expected type [com.org.myProject.entity.Address (n/a)]
Upvotes: 0
Views: 132
Reputation: 222
can u try this
EntityManager em = entityManagerFactory.createEntityManager();
Query query = em.createQuery("SELECT DISTINCT p FROM Person p INNER JOIN p.address a");
List<Person> resultList = query.getResultList();
Upvotes: 1