Reputation: 704
I'm gonna try to explain why i dont want @customValidator to work when i call set method for second time (Not sure if this is actually possible)
I made a custom validation @annotation to check the password strength, the problem is that the first time it get's setted it works well, but then I encrypt the password and it doesn't match anymore (Because the encrypt has no uppercase and things like that). So the question is: Is it possible to tell hibernate validation somehow if I want it to being activated or something like that?, If not, I guess I could do it in the annotation and check if the string follows the encryption pattern but I dont think this is the best way.
Sorry for my poor skills in English hope you understood.
Thanks a lot.
Upvotes: 0
Views: 47
Reputation: 1764
You can keep your current password
field with the validation marked as @javax.persistence.Transient (it won't be stored in your db), and another one passwordEncrypted
without any validation but mapped to your db table. Before persisting (e.g. hibernate entity listener callback) you just have to compute your encrypted password from your clear password. For enhanced security you might also consider this entry.
Upvotes: 1