Is there a way to manipulate Domain object after the validation is completed in Grails ?
I have to encode the password before inserting to database, but i want to do it only after the validation is completed.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For me, what you validate in your gorm object should be what you save. If you want to validate an unencoded password then I suggest you create a command object with suitable constraints on the password and validate that. If the command object passes validation, encode the password and add it to the gorm object you want to insert/update.
This way the gorm object only ever sees encoded passwords and here you should just validate that is not empty (or looks like a hex encoded password).