【发布时间】:2012-02-21 13:31:37
【问题描述】:
我有一个使用 Grails 1.3.7 的应用程序,我刚刚迁移到 Grails 2.0。该应用程序使用自动dateCreated 和lastUpdated 字段来管理与对象的创建和修改相关的时间戳。升级后出现如下错误:
| Running Grails application
| Error 2012-01-29 22:36:53,504 [Thread-8] ERROR util.JDBCExceptionReporter - ERROR: null value in column "date_created" violates not-null constraint
| Error 2012-01-29 22:36:53,510 [Thread-8] ERROR events.PatchedDefaultFlushEventListener - Could not synchronize database state with session
在我的域类中注释掉上述字段会使问题消失。
dateCreated 和 lastUpdated 字段在 Grails 2.0 中是否已被弃用?如果是这样,这是否意味着我必须编写代码来手动处理此功能,或者代码是否已移至某种插件,例如 audit-trail 插件?
【问题讨论】:
标签: grails grails-orm grails-domain-class grails-2.0