我有两个班级:Furniture
和Painting
。那些正在扩展Item
。
项目具有以下代码:
@Entity
public class Item implements Comparable, Serializable {
@Id @GeneratedValue(strategy= GenerationType.AUTO)
private Long id;
@ManyToOne
private User seller;
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "description",
column = @Column(name = "c_description"))})
private Category category;
private String description;
public Item() {
}
public Item(User seller, Category category, String description) {
this.seller = seller;
this.category = category;
this.description = description;
this.seller.addItem(this);
}
绘画有以下代码:
@Entity
public class Painting extends Item {
private String title;
private String painter;
public Painting() {
}
public Painting(String title, String painter, User seller, Category category, String description) {
super(seller, category, description);
this.title = title;
this.painter = painter;
}
家具有以下代码:
@Entity
public class Furniture extends Item {
private String material;
public Furniture() {
}
public Furniture(String material, User seller, Category category, String description) {
super(seller, category, description);
this.material = material;
}
之前,我尝试了一些持久化Item
对象的代码。那工作得很好。现在我正在尝试持久化一个Painting
-object,通过实体管理器持久化它。我收到以下错误:
对象:auction.domain.Furniture@5d3468fd 不是已知的实体类型。
好像我忘记了什么或做错了什么,可能是在Painting
课堂上。会是什么呢?