Closed
Description
Ivan Fedorenkov opened DATAJPA-790 and commented
The exception is thrown when applying @EntityGraph
annotation on the Page<T> findAll(Predicate, Pageable) method in a repository interface.
Example Stacktrace (source: stackoverflow):
org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=appointment,role=com.physioclinic.entity.Appointment.createdBy,tableName=user,tableAlias=user5_,origin=appointment appointmen0_,columns={appointmen0_.createdBy_id ,className=com.physioclinic.entity.User}}] [select count(appointment)
from com.physioclinic.entity.Appointment appointment where lower(concat(concat(appointment.patient.person.name,?1),appointment.patient.person.surname)) like ?2 escape '!']; nested exception is java.lang.IllegalArgumentException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=appointment,role=com.physioclinic.entity.Appointment.createdBy,tableName=user,tableAlias=user5_,origin=appointment appointmen0_,columns={appointmen0_.createdBy_id ,className=com.physioclinic.entity.User}}]
Applying the annotation on the Iterable<T> findAll(Predicate) is not resulting with the exception (works just fine)
Affects: 1.9 GA (Gosling)
Issue Links:
- DATAJPA-684 QueryDslPredicateExecutor + EntityGraph + findAll
("is duplicated by") - DATAJPA-1087 Regression: query hints not applied to count queries for QueryDSL
Referenced from: pull request #182, and commits 297efea, f2453de, 1a04f16, db345e6, 1477c18, 0e9be4e, dc230ef, 3f5467d, 35d5cc2, 1b86b0e, fea2f76, dd0919b
Backported to: 1.10.5 (Hopper SR5), 1.9.7 (Gosling SR7)
2 votes, 5 watchers