私は2つのクラスを持っています.1つはエンティティクラスではなく、すべてのエンティティクラスに共通のフィールドを持つAと仮定します.もう1つはエンティティクラスを拡張するエンティティクラスです.これらのクラスを以下のように定義する方法.
public class A{
private Date startDate;
private Date endDate;
//setters and getters for these fields
}
@Entity
@Table(name="some table name")
public class B extends A{
private long id;
private String duration;
public B(){
}
public B(Date startDate,Date endDate,String duration){
//setter methods for the fields inside the constructor
}
//Setter ,Getter methods for the fields in B class
}
今問題は、アプリケーションを実行すると、B クラスで定義されたフィールドのみでテーブルが作成されることです。テーブルにはスーパー クラス (クラス A) のフィールドがありません。