Java Hibernate 设置最小和最大列长度

Java Hibernate set min and max column length

我需要知道如何在休眠中为列设置最小或最大注释。

@Column (name = "password", 'min = 6, max = 16') // something like this
    private String password;

尝试@Size约束

@Size(min = 6, max = 16)

请参阅 Hibernate 文档中的示例 1.3 https://docs.jboss.org/hibernate/validator/4.0.1/reference/en/html/validator-gettingstarted.html