How to user Hibernate @Valid constraint with Spring 3.x?
- by Burak Dede
I am working on simple form to validate fields like this one.
public class Contact {
@NotNull
@Max(64)
@Size(max=64)
private String name;
@NotNull
@Email
@Size(min=4)
private String mail;
@NotNull
@Size(max=300)
private String text;
}
I provide getter and setters hibernate dependencies on my classpath also.But i still do not get the how to validate simple form there is actually not so much documentation for spring hibernate combination.
@RequestMapping(value = "/contact", method = RequestMethod.POST)
public String add(@Valid Contact contact, BindingResult result) {
....
}
Could you explain it or give some tutorial , except original spring 3.x documentation