Closed IlyaLisov closed 1 month ago
Could you provide a minimal sample project?
This is correct and expected. Sort.Order.desc("views_amount");
would refer to a nested property amount
in the views
property of Article
or Employee
. Sort
refers always to property names unless the query is a native one. Spring Data uses _
as separator to force property name splitting.
I have two entities
Next, I want to sort this entities by using
Sort.Order
object:When I call repository method with custom
@Query
, I get it working. Entities are loaded.When I call repository method without custom
@Query
, it is not working with exceptionNo property 'views' found for type 'Article'
. I don't even understand why it isviews
here in the exception.It works if I change order object to
Sort.Order.desc("viewsAmount")
as it is names in@Entity
.In the documentation I did not find what does
property
mean inSort.Order
methods. I thought it means database column names, but as I see here, it can also mean@Entity
field.