title: How to make an @ManyToOne entity the Id of a class in hibernate
body: <p>I have a problem and tried already allot of ways to solve it.</p>
  
  <p>the problem is quite simple how can I use both the Item ID and the amount as a primary key?</p>
  
  <p>Since this will make the item a tiny blob. And if I use @MapsId it gives the exact same thing.</p>
  
  <pre><code>@Entity
  public class C_Drop extends LightEntity implements Serializable {
  
      @Id
      @ManyToOne
      private C_Item item;
      @Id
      private double amount;
  }
  
  @Entity
  @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
  public class C_Drops extends LightEntity implements Serializable {
  
      @Id
      double id;
  
      @OneToMany
      private List&lt;C_Drop&gt; drops;
  }
  </code></pre>