I want to sort my entities by the name attribute with ascending direction and ignoring the case.
I've created an EntityRepository extending the Repository interface of Spring Data. Then I've declared the following find method:
List<Entity> findByNameOrderByNameIgnoreCaseAsc(String name);
But I get this error "No property ignoreCase found for type".
I can't find any reference to this case in the Spring Data JPA documentation.
I'm using spring-data-jpa version 1.11.0.
If you want just to return all entities with sorting by name with ignore case you can use this:
repository.findAll(Sort.by(Sort.Order.asc("name").ignoreCase()));
Spring Data IgnoreCase
can be only used for finding by a property, and cannot be user in combination with Order by.
However you can get you results using Sort.Order.ignoreCase()
and Pages http://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/Sort.Order.html#ignoreCase--
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With