title: How to use "findBy" in an Entity with a Composite PK (Hibernate JPA)
body: <p>I am learning with bootspring.</p>
  
  <p><code>findByDate(int date);</code> used to work until I've moved <code>int Date</code> into the inner class.</p>
  
  <p>Now I can save new entries but I can't retrive them byDate</p>
  
  <p>What do I need to change?</p>
  
  <pre><code>@Transactional
  public interface ExpirationDAO extends JpaRepository&lt;ExpirationDTO, Long&gt; {
  
      public ExpirationDTO findByDate(int date);
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>@Embeddable
      public static class IdKey implements Serializable{
          @NotNull
          int date;
          @ManyToOne
          ProductDTO product;
  
          public IdKey(){
          }
           //setters and getters
      }
      @EmbeddedId
      private IdKey id;
      @NotNull
      int units;
  
      public ExpirationDTO(){     
      }
         //setters and getters
  }
  </code></pre>
  
  <p>throws this exception:</p>
  
  <pre><code>org.springframework.data.mapping.PropertyReferenceException: No property date found for type ExpirationDTO!
  </code></pre>