我正在将代码更新为 JPA,但在使用鉴别器时出现错误
@Entity
@DiscriminatorValue("3")
public class WidgetContainer extends Square {
...
}
Square.java
@Entity
@Table(name = "square")
@DiscriminatorColumn(name = "squareType", discriminatorType = DiscriminatorType.INTEGER)
@DiscriminatorValue("0")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class Square implements Indexable, Serializable{
...
}
我收到这个错误
org.hibernate.WrongClassException: Object with id: 1 was not of the specified subclass: sym.domain.Square (Discriminator: 3)