title: Relation to abstract class in hibernate
body: <p>I'm designing an entity model like this :</p>
  <pre><code>@Entity(name = &quot;EntityDamage&quot;)
  @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
  public abstract class EntityDamage {
  
      @Id   
      private long damage_id;
  
      @OneToMany(fetch = FetchType.LAZY, mappedBy = &quot;entityDamage&quot;)
      private Set&lt;JTBDamageComment&gt; JTB_Damage_Comment;
      
  }
  
  @Entity(name = &quot;EntityCarDamage&quot;)
  @Table(name = &quot;EntityCarDamage&quot;, schema = &quot;dbo&quot;, catalog = &quot;InsuranceDamageDB&quot;)
  public class EntityCarDamage extends EntityDamage {
      
      
      
  }
  
  @Entity(name = &quot;EntityComment&quot;)
  @Table(name = &quot;EntityComment&quot;, schema = &quot;dbo&quot;, catalog = &quot;InsuranceDamageDB&quot;)
  public class EntityComment {
  
      @Id
      @Column(name = &quot;comment_id&quot;, nullable = false, precision = 0)   
      private long comment_id;
  
  }
  
  @Entity(name = &quot;JTBDamageComment&quot;)
  @Table(name = &quot;JTBDamageComment&quot;, schema = &quot;dbo&quot;, catalog = &quot;InsuranceDamageDB&quot;)
  public class JTBDamageComment {    
  
      @EmbeddedId
      private KeyDamageComment id = new KeyDamageComment();
  
      @ManyToOne
      @MapsId(&quot;damage_id&quot;)
      @JoinColumn(name = &quot;damage_id&quot;)
      private EntityDamage entityDamage;
  
      @ManyToOne
      @MapsId(&quot;comment_id&quot;)
      @JoinColumn(name = &quot;comment_id&quot;)
      private EntityComment entityComment;
  }
  </code></pre>
  <p>In the entity diagram every thing is ok , but the <strong>EntityComment</strong> has not relation to <strong>EntityCarDamagee</strong> in <strong>database level</strong> , cuase the <strong>EntityDamage</strong> is abstract class. my question is : do i change my relation &quot;move relation to <strong>EntityCarDamage</strong> &quot; or another way is exist?</p>