Grails

beforeInsert called before every update

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1-beta1
  • Fix Version/s: 1.1-beta3
  • Component/s: Persistence
  • Labels:
    None
  • Environment:
    Debian Linux, OpenJDK 6, Grails 1.1 SNAPSHOT
  • Testcase included:
    yes

Description

The beforeInsert closure on domain classes is now being called not only when the object is persisted for the first time, but also on every update.

This likely has to do with the changes to ClosureEventTriggeringInterceptor.groovy in r7405, since the closure is called unconditionally from the onSaveOrUpdate handler.

Activity

Hide
Juri Kuehn added a comment -

i have tested all events and it seems that only afterUpdate is affected. onSaveOrUpdate is called before onPreUpdate

Maybe intercepting onPreInsert instead of onSaveOrUpdate will do the trick here (keeping the code from onSaveOrUpdate)
timestamping is handled by onPreUpdate seperately anyway

Show
Juri Kuehn added a comment - i have tested all events and it seems that only afterUpdate is affected. onSaveOrUpdate is called before onPreUpdate Maybe intercepting onPreInsert instead of onSaveOrUpdate will do the trick here (keeping the code from onSaveOrUpdate) timestamping is handled by onPreUpdate seperately anyway
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (2)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: