title: This class does not define an IdClass
body: <p>My for class <code>Class1Item</code> is a reference to an entry in <code>Class1</code>. Hibernate needs me to define an <code>@IdClass</code>. Defining an own Class with the <code>Id</code> of <code>Class1</code> did not work for me. </p>
  
  <p>Here is the error I am getting:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.UnsatisfiedDependencyException:
    Error creating bean with name 'requestMappingHandlerAdapter' defined
    in class path resource
    [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]:
    Unsatisfied dependency expressed through method
    'requestMappingHandlerAdapter' parameter 1; nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'mvcConversionService' defined in class path
    resource
    [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]:
    Bean instantiation via factory method failed; nested exception is
    org.springframework.beans.BeanInstantiationException: Failed to
    instantiate
    [org.springframework.format.support.FormattingConversionService]:
    Factory method 'mvcConversionService' threw exception; nested
    exception is org.springframework.beans.factory.BeanCreationException:
    Error creating bean with name 'bookItemRepository': Invocation of init
    method failed; nested exception is java.lang.IllegalArgumentException:
    This class [class de.models.Class1Item] does not define an IdClass</p>
  </blockquote>
  
  <p>Relevant Classes which are all in the same package:</p>
  
  <pre><code>import javax.persistence.*;
  import javax.validation.constraints.NotNull;
  
  import lombok.*;
  
  import java.io.Serializable;
  import java.time.LocalDate;
  import java.util.List;
  
  @Entity
  @Setter
  @Getter
  @NoArgsConstructor
  @IdClass(Class1ItemId.class)
  public class Class1Item implements Serializable {
  
      @Id
      @ManyToOne
      @JoinColumn(name="reference")
      private Class1 class1;
  
      @NotNull
      @GeneratedValue
      private Long number;
  
      @Column(name="date_one")
      private LocalDate date1;
  
      @Column(name="date_x")
      private LocalDate dateX;
  
      @ManyToOne
      @JoinColumn(name="userReference")
      private User userReference;
  
      @ManyToMany
      @JoinColumn(name="waitingUsers")
      private List&lt;User&gt; waitingUsers;
  
      @NotNull
      @Enumerated(EnumType.STRING)
      @Column(name="enumX")
      private EnumX enumX;
  
  }
  </code></pre>
  
  <hr>
  
  <pre><code>import javax.persistence.*;
  import javax.validation.constraints.NotBlank;
  
  import lombok.*;
  
  import java.io.Serializable;
  
  @Entity
  @Setter
  @Getter
  @NoArgsConstructor
  public class Class1 implements Serializable {
  
      @Id
      @NotBlank
      private String key;
  
      @NotBlank
      private String name;
  
      @NotBlank
      private String nameF;
  
      @NotBlank
      private String nameL;
  
      private String path;
  }
  </code></pre>
  
  <hr>
  
  <pre><code>import javax.persistence.*;
  import javax.validation.constraints.NotNull;
  
  import lombok.*;
  
  import java.io.Serializable;
  import java.util.Set;
  
  @Entity
  @Setter
  @Getter
  @NoArgsConstructor
  public class User implements Serializable {
  
      @Id
      @Column(name="UserID")
      private Long id;
  
      @NotNull
      @Column(name="email",unique=true)
      private String email;
  
      @NotNull
      @Column(name="user_firstname")
      private String firstName;
  
      @NotNull
      @Column(name="user_lastname")
      private String lastName;
  
      @NotNull
      @Column(name="isAdmin")
      private Boolean isAdmin;
  
      @ManyToMany
      @Column(name="wantedItems")
      private Set&lt;Class1Item&gt; wantedItems;
  
      @OneToMany
      @Column(name="borrowedItems")
      private Set&lt;Class1Item&gt; itemsBorrowed;
  }
  </code></pre>
  
  <hr>
  
  <pre><code>import javax.persistence.Id;
  import java.io.Serializable;
  
  public class Class1ItemId implements Serializable {
      @Id
      private String key;
  }
  </code></pre>
  
  <p>How do I fix this error when there's actually an IdClass defined?</p>