title: spring data jpa - Parameter value [Book] did not match expected type [ContentType]
body: <p>I have two simple tables, <code>content</code> and <code>contentType</code></p>
  
  <pre><code>@Entity
  @Table(name = "content")
  public class Content implements Serializable {
  
  public Content() {}
  
  public Content(String title, String description) {
      this.title = title;
      this.description = description;
  }
  
  @Id
  @GeneratedValue(strategy = GenerationType.SEQUENCE)
  private long id;
  
  @ManyToOne
  private ContentCategory contentCategory;
  
  @ManyToOne
  private ContentType contentType;
  
   // getter/setters
  }
  
  @Entity
  @Table(name = "contentType")
  public class ContentType implements Serializable {
  
  public ContentType() {}
  
  public ContentType(String contentType) {
      this.contentType = contentType;
  }
  
  @Id
  @GeneratedValue(strategy = GenerationType.SEQUENCE)
  private long id;
  
  @NotNull
  private String contentType;
  
  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "contentType")
  private Set&lt;Content&gt; content;
  `// getter/setters` }
  </code></pre>
  
  <p><code>Each content has exactly one type, but many type might be exists in many contents</code></p>
  
  <p>I am going to retrieve contents with type <code>Book</code></p>
  
  <p>Here is my repository"</p>
  
  <pre><code>public interface ContentRepository extends JpaRepository&lt;Content, Long&gt; {
  
      Iterable&lt;Content&gt; findByContentType(String contentType);
  }
  </code></pre>
  
  <p>And Here is my test method:</p>
  
  <pre><code>@Test
  public void retrieve_content_based_on_type() {
  
      // create and insert a sample content type, i.e. a Book
  
      ContentType contentType1 = new ContentType("Book");
      contentTypeRepository.save(contentType1);
  
      //create and insert two contents corresponding to this type
      Content cont1 = new Content("t1", "d1");
      cont1.setContentType(contentType1);
      contentRepository.save(cont1);
  
      Content cont2 = new Content("t2", "d2");
      cont2.setContentType(contentType1);
      contentRepository.save(cont2);
  
  
      //retrieve all contents which their type is Book
  
      Iterable&lt;Content&gt; allBooks = contentRepository.findByContentType("Book");
      for (Content eachBook : allBooks) {
          System.out.println(eachBook);
      }
  }
  </code></pre>
  
  <p>I got this exception:</p>
  
  <pre><code>org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [Book] did not match expected type [com.aa.bb.domain.ContentType (n/a)]; 
  
  nested exception is java.lang.IllegalArgumentException: Parameter value [Book] did not match expected type [com.aa.bb.domain.ContentType (n/a)]
  </code></pre>