Query by Example Spring Data

后端 未结 1 420
深忆病人
深忆病人 2021-01-06 13:44

I have domain object Person with date fields:

public class Person {
@Id
private Long id;
private Date date

Build example like this:

相关标签:
1条回答
  • 2021-01-06 13:53

    The Spring Data JPA query-by-example technique uses Examples and ExampleMatchers to convert entity instances into the underlying query. The current official documentation clarifies that only exact matching is available for non-string attributes. Since your requirement involves a java.util.Date field, you can only have exact matching with the query-by-example technique.

    You could write your own ExampleMatcher that returns query clauses according to your needs.

    0 讨论(0)
提交回复
热议问题