简体   繁体   English

Grails dateCreated字段失败,“not-null属性引用null或transient值”

[英]Grails dateCreated field fails with “not-null property references a null or transient value”

I'm struggling to understand an error I'm getting with the Grails spring security UI plugin. 我正在努力理解我在Grails spring安全UI插件中遇到的错误。 Fundamentally the problem seems independent of that particular plugin, though. 但从根本上说,问题似乎与该特定插件无关。

The RegistrationCode domain class (see https://github.com/grails-plugins/grails-spring-security-ui/blob/master/grails-app/domain/grails/plugin/springsecurity/ui/RegistrationCode.groovy?source=cc ) has a dateCreated field, which uses the grails autoTimeStamp feature to populate it at creation. RegistrationCode域类(参见https://github.com/grails-plugins/grails-spring-security-ui/blob/master/grails-app/domain/grails/plugin/springsecurity/ui/RegistrationCode.groovy?source= cc )有一个dateCreated字段,它使用grails autoTimeStamp功能在创建时填充它。 It seems to work 80% of the time, but I'm getting: 它似乎有80%的工作时间,但我得到:

Exception Message: not-null property references a null or transient value: grails.plugin.springsecurity.ui.RegistrationCode.dateCreated 
Caused by: not-null property references a null or transient value: grails.plugin.springsecurity.ui.RegistrationCode.dateCreated 
Class: RegisterController 
At Line: [58]

This corresponds to the following code: 这对应于以下代码:

registrationCode = new RegistrationCode(username: user?.username)                                                                                                                               
registrationCode.save(flush: true)  

Again, the code seems to almost always work, but occasionally it seems to complain that the dateCreated field is null. 同样,代码似乎几乎总是有效,但偶尔似乎抱怨dateCreated字段为null。

Any thoughts on why the autoTimeStamp periodically fails to fill in the dateCreated field? 有关为什么autoTimeStamp定期无法填写dateCreated字段的任何想法?

I'm using Grails 2.2.4 and Mysql 5.5.27 我正在使用Grails 2.2.4和Mysql 5.5.27

It might be this bug: http://jira.grails.org/browse/GRAILS-9805 It's fixed in Grails 2.3.4. 可能是这个错误: http//jira.grails.org/browse/GRAILS-9805它已在Grails 2.3.4中修复。

What database and Grails version are you using? 您使用的是什么数据库和Grails版本?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM