Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort by @JsonProperty value of entity field not working when upgrade from v2.1.10 to v2.2.4 [DATACMNS-1662] #2083

Closed
spring-projects-issues opened this issue Jan 29, 2020 · 3 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Jan 29, 2020

ahmadabulaban opened DATACMNS-1662 and commented

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


Affects: 2.2.4 (Moore SR4)

@mp911de
Copy link
Member

@mp911de mp911de commented Jan 26, 2021

@ahmadabulaban can you attach the full stack trace? Also, the property name you're wanting to sort by is requestId. id is just the name under which the property requestId gets serialized to JSON.

@mp911de mp911de added status: waiting-for-feedback and removed in: repository type: bug labels Jan 26, 2021
@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Feb 2, 2021

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder label Feb 2, 2021
@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Feb 9, 2021

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback status: feedback-reminder labels Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants