我在hibernate项目中使用@MappedSuperclass:
@MappedSuperclass
public abstract class AbstractHotel extends AbstractData {
protected String id;
protected String name;
protected String type;
....
}
@Entity
@Table(name = "T_HOTEL")
public class Hotel extends AbstractHotel {
@AttributeOverride(name = "id", column = @Column(name = "hotel_id"))
protected String id;
@AttributeOverride(name = "name", column = @Column(name = "hotel_name"))
protected String name;
@AttributeOverride(name = "type", column = @Column(name = "hotel_type"))
protected String type;
...
}如图所示,我希望列在子类中可以是过行,但是我得到了错误:
org.hibernate.MappingException: Duplicate property mapping of id found in cn.test.Hotel能解决这个问题吗?
发布于 2015-03-17 02:40:58
您不应该在子类中再次定义字段:签出以下内容:https://stackoverflow.com/a/5258090/286588
https://stackoverflow.com/questions/29089697
复制相似问题