hibernate - JPA MappedSuperClass -
i using @mappedsuperclass
in hibernate project:
@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; ... }
as shown, want column can overrideed in subclass, error:
org.hibernate.mappingexception: duplicate property mapping of id found in cn.test.hotel
is possible fix this?
you should not define fields again in child class : check out : https://stackoverflow.com/a/5258090/286588
Comments
Post a Comment