Annotation @Check has in documentation following targets: {code} @Target({TYPE, METHOD, FIELD}) {code} When I place it over entity it properly creates "check" in the database (using hbm2ddl): {code} @Entity @Check(constraints = "sex IN ('WOMAN' ,'MAN')") @Table(name = "person") public class Person implements Serializable{ //... {code}
But It doesn't work when placed over a field - check is not being created in the database at all: {code} @NotNull @Column(name = "sex", nullable = false) @Enumerated(EnumType.STRING) @Check(constraints = "sex IN ('WOMAN' ,'MAN')") private Sex sex; {code} |
|