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

Projection data is not mapped correctly on Hibernate 5.0

    XMLWordPrintable

    Details

      Description

      Incorrectly mapped values on page summaries.

      See https://github.com/spring-projects/spring-boot/issues/12720 for a test that reproduces the error.

      The problem seems to come from this line in the test

      Page<HotelSummary> hotels = this.repository.findByCity(city,
      		new PageRequest(0, 10, Direction.ASC, "name"));
      

      For some reason the HotelSummary seems to have data mapped to the wrong methods. Digging in a bit, the problem appears to be somewhere in org.springframework.data.repository.query.ResultProcessor. Specifically getProjectionTarget is called with a source containing the following:

      [Atlanta,GA,USA, Doubletree, 2.0]
      

      And attempts to convert it using toMap. This gets passed the following names:

      [averageRating, city, name]
      

      There are not in the same order. Perhaps DefaultProjectionInformation.collectDescriptors is not returning methods in a defined order. Possibly related to SPR-16675?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              pwebb Phil Webb
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: