Angel Villalain edited a comment on Improvement HHH-4751

Lukasz Antoniak Check this code sample.

@Audited
@Entity(name = "ClassA")
@Table(name = "ClassA")
@Inheritance(strategy = InheritanceType.JOINED)
@IdClass(ClassId.class)
public class ClassA{
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "Id")
    private Long;
    @Id
    @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "ClassTypeName", referencedColumnName = "Name",
                insertable = true, updatable = true, nullable = false)
    @ForeignKey(name = "FK_ClassA_ClassType")
    private ClassType type;
...
}
public static class ClassId {
    private Long id;
    private ClassType type;

    ClassId (){}
}
@Audited
@Entity(name = "ClassB")
@Table(name = "ClassB")
@PrimaryKeyJoinColumns({
    @PrimaryKeyJoinColumn(name = "ClassBId",
                          referencedColumnName = "Id"),
    @PrimaryKeyJoinColumn(name = "ClassTypeName",
                          referencedColumnName = "ClassTypeName")
})
@Check(constraints = "ClassTypeName= 'VALUE'")
public class ClassB extends ClassA {
    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(name = "ClassCId", referencedColumnName = "Id",
                insertable = true, nullable = true, updatable = true)
    @ForeignKey(name = "FK_ClassB_ClassC")
    private ClassC classC;
...
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira