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

Does spring data rest supports sorting on inherited fields? #2363

Closed
prasannabalaraman opened this issue Feb 12, 2024 · 1 comment
Closed
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@prasannabalaraman
Copy link

My entity class extends an audit class with audit fields (createdDate, createdBy, modifiedDate, modifiedBy). My repo extends PagingAndSortingRepository. Sorting is not working if I use any of the audit fields but it works if I pass any of the fields in the entity class.

I am using spring data rest 2.7.12.

{{baseUrl}}/{{apiVersion}}/{{apiContext}}/apps?sort=createdDate,desc&size=50

I also noticed "order by" in the generated sql for the entity class fields but not for the audit class fields.

Appreciate your help.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 12, 2024
@prasannabalaraman
Copy link
Author

After further analysis I figured out that I had @JsonIgnore on those audit fields. That was the reason it did not work. I removed it and it is working now. This issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants