我想用 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
有任何想法吗?谢谢。