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
什么想法?谢谢。