I am trying to use the Example of Spring JPA to do the search. With the following code, most of it fits the requirements.
public Page<Shop> findShops(Shop condition, Pageable pageable) {
ExampleMatcher matcher = ExampleMatcher.matching().withStringMatcher(StringMatcher.CONTAINING).withIgnoreCase();
return shopDao.findAll(Example.of(condition, matcher), pageable);
}
In addition, I ONLY need the SHOP with status NOT equals DELETED.
Something like, .withMatcher("status", notEqual())
or maybe .withMatcher("status", contains())
a list.
I am not sure if and how Example Matcher could do such thing. Could anybody help me with this?
For the one WHERE
clause you dont need QBE. Query from method should be enough:
Page<Shop> findByStatusNot(String status, Pageable page);
http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation
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