hibernate validator用法

AnnotationApply onRuntime checkingHibernate Metadata impact
@Length(min=, max=)property (String)check if the string length match the rangeColumn length will be set to max
@Max(value=)property (numeric or string representation of a numeric)check if the value is less than or equals to maxAdd a check constraint on the column
@Min(value=)property (numeric or string representation of a numeric)check if the value is more than or equals to minAdd a check constraint on the column
@NotNullpropertycheck if the value is not nullColumn(s) are not null
@NotEmptypropertycheck if the string is not null nor empty. Check if the connection is not null nor emptyColumn(s) are not null (for String)
@Pastproperty (date or calendar)check if the date is in the pastAdd a check constraint on the column
@Futureproperty (date or calendar)check if the date is in the futurenone
@Pattern(regex="regexp", flag=) or @Patterns( {@Pattern(...)} )property (string)check if the property match the regular expression given a match flag (see java.util.regex.Pattern )none
@Range(min=, max=)property (numeric or string representation of a numeric)check if the value is between min and max (included)Add a check constraint on the column
@Size(min=, max=)property (array, collection, map)check if the element size is between min and max (included)none
@AssertFalsepropertycheck that the method evaluates to false (useful for constraints expressed in code rather than annotations)none
@AssertTruepropertycheck that the method evaluates to true (useful for constraints expressed in code rather than annotations)none
@Validproperty (object)perform validation recursively on the associated object. If the object is a Collection or an array, the elements are validated recursively. If the object is a Map, the value elements are validated recursively.none
@Emailproperty (String)check whether the string is conform to the email address specificationnone
@CreditCardNumberproperty (String)check whether the string is a well formated credit card number (derivative of the Luhn algorithm)none
@Digitsproperty (numeric or string representation of a numeric)check whether the property is a number having up to integerDigits integer digits and fractionalDigits fractonal digitsdefine column precision and scale
@EANproperty (string)check whether the string is a properly formated EAN or UPC-A codenone
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值