I would like to have a property specified update="false" in almost every case. But there is exactly one business method where I want to update this value in the database.
Why do I want to do that?
Well, my persistent object is a User-object and the property is the user password. I'd like to set the password on user creation/insert - so I leave the <property insert="true">.
The persistent object doesn't have a public getPassword()-getter because I don't want to make the password readable.
I have to copy/pass the persistent object to other "higher-level" business objects but now I can't copy/pass the password. When updating the business object (the underlying persistent object) I want everything getting updated but not the password. That's why I want to specify update="false" in the mapping file.
But of course there is a changePassword(old, new)-method where I need to update the password-field!
So my question: Is it possible to force the property to update="true" during execution of the changePassword-method (before the session.update(obj)) and revert it back after the update?
Many thanks for your help!
|