1

InheritanceType.JOINED を使用して、スーパークラスとサブクラスをデータベースに格納したいと考えています。しかし、それをしようとするたびに、エラーが発生します-これRepeated column in mapping for entity: com.inqool.personalpro.entity.QuestionAlgorithm column: id (should be mapped with insert="false" update="false") が私のエンティティです:

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Question implements Serializable {

    private Long id;

    @Id
    @GeneratedValue
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    ...
}

@Entity
@PrimaryKeyJoinColumn(name="id")
public class QuestionAlgorithm extends Question {

    private Long id;

    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    ...
}

サブクラスからフィールド 'id' を削除すると、次のエラーが発生します。Could not locate table which owns column [id] referenced in order-by mapping

何か案は?ありがとう。

4

1 に答える 1