Skip to content

Instantly share code, notes, and snippets.

@recursivecodes
Created July 1, 2019 14:41
Show Gist options
  • Save recursivecodes/ca05ffff4a7f3625495496c95656d829 to your computer and use it in GitHub Desktop.
Save recursivecodes/ca05ffff4a7f3625495496c95656d829 to your computer and use it in GitHub Desktop.
UserRepository.java
public Set<ConstraintViolation<User>> validate(User user) {
    Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
    Set<ConstraintViolation<User>> constraintViolations = validator.validate(user);
    return constraintViolations;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment