开发者

Hibernate subclass to override a column

开发者 https://www.devze.com 2023-03-27 22:27 出处:网络
We have an Entity library untouched by our web stack, but our web stack would like to extend existing columns on existing entities with validation constraints.Here\'s one example of the \"goal\":

We have an Entity library untouched by our web stack, but our web stack would like to extend existing columns on existing entities with validation constraints. Here's one example of the "goal":

@Entity
@Table(name="Person")
public class WebPerson extends Person {
    @Ov开发者_高级运维erride
    @Validate("require")
    public String getName() { return super.getName(); }
}

Is this possible? We can't use InheritanceType.SINGLE_TABLE because that mandates a silly DTYPE. Person as MappedSuperclass gives us a "Duplicate property mapping of" error. Help! Thanks.

0

精彩评论

暂无评论...
验证码 换一张
取 消