Tuesday, 15 March 2011

Howto Execute a action from domain class after the controller action is done in Grails -



Howto Execute a action from domain class after the controller action is done in Grails -

need execute action domain class after controller action done in grails.

some thing beforeinterceptor / afterinterceptor. in generic looking , need automatically invoke post save action domain class.

any kind of solution appreciable.

please have @ link here: http://grails.org/doc/latest/guide/gorm.html#eventsautotimestamping

you utilize these events straight in domain class aware of not doing flush:true.

do not effort flush session within event (such obj.save(flush:true)). since events fired during flushing cause stackoverflowerror.

sample link.

class person { private static final date null_date = new date(0) string firstname string lastname date signupdate = null_date def beforeinsert() { if (signupdate == null_date) { signupdate = new date() } } }

grails

No comments:

Post a Comment