title: how to use spring data example matcher for list attribute - query issue
body: <p>I would like to ask how to use exampleMatcher for class with List attribute. Lets assume, we have a user which can have multiple roles at the same time. I want to get all users with user role from DB</p>
  
  <p>entities</p>
  
  <pre><code>@Entity(name = "UserEntity")
  public class User {
      Private Long id;
      private String name;
      private String surname;
  
      @OneToOne(cascade = CascadeType.ALL)
      @JoinColumn
      private Address address;
  
      @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
      @JoinColumn
      private List&lt;UserRole&gt; roles;
  }
  
  @Entity
  public class UserRole {
      private Long id;    
      private String name;
  }
  </code></pre>
  
  <p>I send an User class with some attributes to getExampleEntity. I am trying to send the list of selected roles from UI now.</p>
  
  <p>function in controller </p>
  
  <pre><code>@Override
      protected User getExampleEntity() {
          User clonedUser = new User();
          List&lt;UserRole&gt; selectedRole = new ArrayList&lt;&gt;();
          // this cycle just find and add all roles in db based on selection from UI
          for (Long roleID : selectedUserRoleIDs)
             selectedRole.add(userRoleService.find(roleID));
          clonedUser.setRoles(selectedRole);
          return clonedUser;
      }
  </code></pre>
  
  <p>Function from JpaRepository, which call findByExample function with example Matcher.</p>
  
  <pre><code>    @Override
      public List&lt;TObjectType&gt; findByExample(int first, int pageSize, String sortField, Sort.Direction sortOrder, TObjectType type)
      {
          PageRequest pageRequest = getPageRequest(first, pageSize, sortField, sortOrder);
          ExampleMatcher exampleMatcher = getExampleMatcher();
          Example&lt;TObjectType&gt; example = Example.of(type, exampleMatcher);
          return repository.findAll(example, pageRequest).getContent();
      }
  
      /**
       * Generates an example matcher for the instance of {@link TObjectType}.
       * This can be overriden if a custom matcher is needed! The default property matcher ignores the "id" path and ignores null values.
       * @return
       */
      protected ExampleMatcher getExampleMatcher() {
          return ExampleMatcher.matching()
                  .withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING)
                  .withIgnoreNullValues();
  
      }
  </code></pre>
  
  <p>It works as a dream if will send a User with attribute name/surname or even any attribute in Address class,  but it does not work with List roles.
  I will appreciate any tips how to solve this problem and how I can use findByExample with array of TObjectType as an attribute.
  Thank you very much </p>
  
  <p>EDIT:
  I found the problem. There is a code of repository.findAll function (org.springframework.data.repository.query.QueryByExampleExecutor#findAll)</p>
  
  <pre><code>@Override
      public &lt;S extends T&gt; Page&lt;S&gt; findAll(Example&lt;S&gt; example, Pageable pageable) {
  
          ExampleSpecification&lt;S&gt; spec = new ExampleSpecification&lt;S&gt;(example);
          Class&lt;S&gt; probeType = example.getProbeType();
          TypedQuery&lt;S&gt; query = getQuery(new ExampleSpecification&lt;S&gt;(example), probeType, pageable);
  
          return pageable == null ? new PageImpl&lt;S&gt;(query.getResultList()) : readPage(query, probeType, pageable, spec);
      }
  </code></pre>
  
  <p>Generated query does not include list attribute, but I have no idea why and it is included of Example object. Has someone experience with this problem? I guess that there is some setting/annotation problem only.</p>