我需要知道如何在hibernate中为列设置min或max注释。
@Column (name = "password", 'min = 6, max = 16') // something like this
private String password;
答案 0 :(得分:3)
尝试@Size约束
@Size(min = 6, max = 16)
请参阅Hibernate文档中的示例1.3 https://docs.jboss.org/hibernate/validator/4.0.1/reference/en/html/validator-gettingstarted.html