Use groups. For example:
Code:
@Size(min=4,max=8,groups=PasswordValidation.class)
@NotNull(groups=PasswordValidation.class)
@Transient
private String validationPassword;
@NotNull
private String password;
then
Code:
public interface PasswordValidation {} // empty interface for group
and
Code:
// initial validation of plain-text password ONLY:
validator.validate(myDomainObject, PasswordValidation.class);
// later, validate EVERYTHING ELSE (including @NotNull on 'password'):
validator.validate(myDomainObject); // default group
You can have @NotNull with @Transient as long as you control WHEN the field is validated (with groups). The transient field will be reset to null the next time you find the object from the database.