Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1662

Sort by @JsonProperty value of entity field not working when upgrade from v2.1.10 to v2.2.4

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.2.4 (Moore SR4)
    • Fix Version/s: None
    • Component/s: Query, Repositories
    • Labels:
      None

      Description

      I was using the spring-data v2.1.10 and i have the following entity

       

      @Entity
      public class RequestEntity extends ResourceSupport {
      
      @Id
      @JsonProperty(value = "id")
      @Column(name = "ID", nullable = false)
      @GeneratedValue
      private Long requestId;
      
      @Column(name = "STATUS", nullable = false)
      private String status;
      
      
      .....
      
      }

       

      I was able to use "id" as a sort field in Pageable of QuerydslPredicateExecutor findAll method :

      @GetMapping
      public ResponseEntity<PagedResources<RequestEntity>> listRequest(@PageableDefault(sort = "id") Pageable pageable){
      Predicate predicate;
      
      ......
      
      return ResponseEntity.ok(toPagedResource(repository.findAll(predicate, pageable)));
      }
      
      private PagedResources<RequestEntity> toPagedResource(Page<RequestEntity> page) {
          return new PagedResources<>(page.getContent(), PageMapper.createPageMetaData(page));
      }

      After upgrading to v2.2.4 the findAll return the following exception

       

      org.springframework.data.mapping.PropertyReferenceException: No property id found for type RequestEntity

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            ahmadabulaban ahmadabulaban
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: