title: Jpa Parameter value element [xxx] did not match expected type [xxx]
body: <p>I have a Jpa method like below.</p>
  
  <pre><code>Set&lt;ApplicationMaterialFile&gt; findAllByProcessInstanceIdAndApplicationMaterialIn(String processInstanceId, Collection&lt;ApplicationMaterial&gt; applicationMaterials);
  </code></pre>
  
  <p>This is the code for call the above Spring Data JPA method. And here will be throw a exception when to call the above Spring Data JPA method.</p>
  
  <pre><code>@Override
      public Set&lt;ApplicationMaterialFile&gt; getAllByProcessInstanceIdApplicationMaterialIds(String processInstanceId, Set&lt;Long&gt; applicationMaterialId) {
          List&lt;ApplicationMaterial&gt; applicationMaterials = applicationMaterialService.getAllByIdIfNotExistsThenThrowException(applicationMaterialId);
  
          return applicationMaterialFileRepository.findAllByProcessInstanceIdAndApplicationMaterialIn(processInstanceId, applicationMaterials);
      }
  </code></pre>
  
  <p>Here is the ApplicationMaterial entity struct. </p>
  
  <pre><code>/**
   * 
   * @see &lt;a href="https://code.aliyun.com/butterfly-effect/backend/wikis/plans"
   * @author himly z1399956473@gamil.com
   */
  @Table(name = "application_material_library")
  @Entity
  @EntityListeners(AuditingEntityListener.class)
  @Data
  @ToString(exclude = {"university"})
  @EqualsAndHashCode(exclude = {"university"})
  public class ApplicationMaterial {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
  
      @Column(nullable = false)
      private String name;
  
      private String fileFormat;
  
  
      private String description;
  
  
      private String templateFileUrl;
  
  
      @JsonIgnore
      @ManyToOne
      private University university;
  
  
      @CreatedDate
      @Column(nullable = false)
      private Timestamp createdAt;
  
  
      @LastModifiedDate
      @Column(nullable = false)
      private Timestamp updatedAt;
  }
  </code></pre>
  
  <p>When to call the Spring Data JPA method <code>findAllByProcessInstanceIdAndApplicationMaterialIn</code>  will throw a exception like below</p>
  
  <blockquote>
    <p>Caused by: java.lang.IllegalArgumentException: Parameter value element
    [ApplicationMaterial(id=1, name=sdfsf, fileFormat=doc,
    description=dfsdfds, templateFileUrl=fsdfsdf, createdAt=2018-09-26
    16:54:09.297, updatedAt=2018-09-26 16:54:23.451)] did not match
    expected type [com.hikedu.backend.model.ApplicationMaterial (n/a)]</p>
  </blockquote>
  
  <p>Can someone please help me?</p>
  
  <p>Update:</p>
  
  <p>The table struct:</p>
  
  <pre><code>-- auto-generated definition
  create table application_material_library
  (
    id                bigint auto_increment
      primary key,
    created_at        datetime(6)  not null,
    description       varchar(255) null,
    file_format       varchar(255) null,
    name              varchar(255) not null,
    template_file_url varchar(255) null,
    updated_at        datetime(6)  not null,
    university_id     bigint       null,
    constraint FK9kuemh1kjhyt8u16sqw6i6t59
    foreign key (university_id) references universities (id)
  );
  </code></pre>