jpa - Stop some validations at the persist time in Spring -
is there way stop validations executed @ time of data persist.
i know
spring.jpa.properties.javax.persistence.validation.mode=none
but believe disables validations, want disable of fields (password specifically, encoded time , pattern doesn't match). thanks!
update(more details):
@pattern(regexp = "^[a-za-z0-9_@!]+$") private string password;
i have password field validated using above pattern (a-z, a-z, 0-9 , _,@,!). in controller validates success below code.
@requestmapping(value = "/adduser", method = requestmethod.post) public modelandview signup(modelandview modelandview, @modelattribute @valid loginuser loginuser, bindingresult bindingresult) { loginuser loginuseradded = null; if (!bindingresult.haserrors()) { loginuser.setpassword(passwordencoder.encode(loginuser.getpassword())); loginuseradded = createuser(loginuser); ....
but before persist encode password , throws error while calling save method in jparepository because password value has been changed encoder , doesnt satisfy pattern validation applied it.
now looking way can disable validation on field @ time of persist.
Comments
Post a Comment