Uploaded image for project: 'Spring Data JPA'
  1. Spring Data JPA
  2. DATAJPA-790

org.hibernate.QueryException when applying @EntityGraph on (Querydsl) findAll(Predicate, Pageable) method

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9 GA (Gosling)
    • Component/s: Querydsl
    • Labels:
      None
    • Environment:
      Java 1.8
      Spring Boot 1.3.0.BUILD-SNAPSHOT
      Hibernate (auto version from the "spring-boot-starter-data-jpa" dependency)
      QueryDSL 3.6.6

      Description

      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).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              ifedorenkov Ivan Fedorenkov
              Last updater:
              Spring Issues Spring Issues
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: