B、C 類繼承 A 所有屬性,並且主鍵均為資料庫(auto_increment)
@MappedSuperclass @(strategy = InheritanceType.TABLE_PER_CLASS) public class A{ @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; }
@Entity @Table(name="b") public class B extends A{ }
@Entity @Table(name="c") public class C extends A{ }