有一个@MappedSuperClass SomeClass
(参见下面的最小示例),是否可以覆盖扩展中的@Pattern
通孔?@AttributeOverride
SomeOtherclass
SomeClass
@MappedSuperClass
public abstract class SomeClass {
@Column(name = "NAME", length = 255, unique = false, nullable = true)
@Pattern(regex = "([a-zA-Z0-9]+_)*([a-zA-Z0-9]+)")
private String name;
…
}
@AttributeOverride(name = "name", column = @Column(name = "NAME", length = 20, unique = false, nullable = false))
public class SomeOtherClass extends SomeClass {
….
}
或者有没有其他方法可以@Pattern
为继承的类定义一个新的?