In my application many classes have common field ‘company’. When application saves that objects, they must be filled with company (there is validation for that). Company is also kept in a session. Now, when I want to use domain class as a command object, company must be already filled or I get validation error. Is there any way to always fill company field, before any validation happens, so that I didn’t have to do it manually every time.
(I tried custom data binder, but it does not work when there is no parameter in a request)
In my application many classes have common field ‘company’. When application saves that objects,
Share
You could set the property just before the object is saved, updated or validated using the GORM events
beforeInsert,beforeUpdateorbeforeValidate.In your domain you need something like that: