我在我的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
有可能解决这个问题吗?