idクラスの識別子列に継承の問題があります。テーブルは正常に作成されますが、各エントリはdescriminator列に「0」の値を取得します。
これが私の基本クラスです:
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.INTEGER)
@IdClass(BasePK.class)
@SuppressWarnings("serial")
public abstract class Base implements Serializable {
@Id
protected Test test;
@Id
protected Test2 test2;
@Id
private int type;
....
}
これが私の基本pkクラスです:
@Embeddable
public static class BasePK implements Serializable {
@ManyToOne
protected Test test;
@ManyToOne
protected Test2 test2;
@Column(nullable = false)
protected int type;
...
}
そして、私はこのようないくつかのサブクラスを持っています:
@Entity
@DiscriminatorValue("1")
@SuppressWarnings("serial")
public class Child extends Base {
}
したがって、新しい子クラスを永続化すると、タイプとして「1」が期待されますが、「0」になります。BasePKクラスからタイプを削除し、Baseクラスに直接追加すると機能します。ただし、タイプはキーの一部である必要があります。
どんな助けでも大歓迎です。