### javax.validationパッケージ
@Null, @NotNull
@Min, @Max
@DecimalMin, @DecimalMax
@Digits
@Future @Past
@Size
@Pattern
### Hibernate Validatorアノテーション
@NotEmpty
@Length
@Range
@Email
@CreditCardNumber
@EAN
エンティティ
@Column(length = 50, nullable = false) @NotNull(message="空白は不可") private String name; @Column(length = 200, nullable = true) @Email(message="メールアドレスのみ") private String mail; @Column(nullable = true) @Min(value=0,message="ゼロ以上") @Max(value=200,message="200以下") private Integer age;
ValidationMessages.properties
org.hibernate.validator.constraints.NotBlank.message = \u7A7A\u767D\u306F\u4E0D\u53EF\u3067\u3059\u3002 org.hibernate.validator.constraints.NotEmpty.message = \u7A7A\u767D\u306F\u4E0D\u53EF\u3067\u3059\u3002 javax.validation.constraints.Max.message = {value}\u3088\u308A\u5C0F\u3055\u304F\u3057\u3066\u4E0B\u3055\u3044\u3002 javax.validation.constraints.Min.message = {value}\u3088\u308A\u5927\u304D\u304F\u3057\u3066\u4E0B\u3055\u3044\u3002 org.hibernate.validator.constraints.Email.message=\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002