0
我想使用InheritanceType.JOINED在數據庫中存儲超類和子類。但每次我嘗試這樣做,我得到一個錯誤 - Repeated column in mapping for entity: com.inqool.personalpro.entity.QuestionAlgorithm column: id (should be mapped with insert="false" update="false")
這裏有我的實體:java hibernate - 具有InheritanceType.JOINED的重複列
@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;
}
...
}
當我從子類中刪除字段「身份證」,我得到這個錯誤:Could not locate table which owns column [id] referenced in order-by mapping
什麼想法?謝謝。