title: Spring Data JPA: Using Example to filter date as string
body: <p>Trying to test if a LocalDate contains a given year, day or month.</p>
  <p>For example, given the criteria &quot;1979&quot;, I'd like filter the rows returned by a <code>findAll(Example&lt;S&gt; example)</code> JPA query in such way that it will return any row containing &quot;1979&quot;.</p>
  <p>The &quot;problem&quot; is that the entity defines the date (let say a birth date) as a <code>LocalDate</code> and as such, doing:</p>
  <pre><code>ExampleMatcher personFilter = ExampleMatcher.matchingAll()
  .withMatcher(&quot;birthDate&quot;, ExampleMatcher.GenericPropertyMatchers
  .contains().ignoreCase());
  
  personPage = repository.findAll(personFilter);
  </code></pre>
  <p>with PersonFilter#birthDate being itself a <code>LocalDate</code>.</p>
  <p>Basically, I would have to have this entity to declare the birth date as a String for the filter to work, but that is not possible as the DB itself store it as a <code>date</code>.</p>
  <p>Is there a way to solve such problem ? Like overriding the way the matching work ?</p>