Hibernate Tutorial - Part V
For previous posts, refer: Hibernate tutorial Part - I Hibernate tutorial Part - II Hibernate tutorial Part - III Hibernate tutorial Part - IV In this post, we are going to take a look at ' Table per subclass' approach for inheritance. Table per subclass: This strategy, represents inheritance relationships as relational foreign key associations.Every class/subclass that declares persistent properties, including abstract classes and even interfaces has its own table. Unlike the table per concrete class strategy, the table here contains columns only for each non inherited property (each property declared by the subclass itself) along with a primary key that is also a foreign key of the super class table. Lets take a look at the class definitions and annotations: User Class: @Entity @Table(name = "USER") @Inheritance(strategy=InheritanceType.JOINED) public class User implements Serializable{ @Id @Column(name = "USER_ID&quo