在 grails 验证器中包含查询时出现堆栈溢出
altEmailAddress(blank: true, nullable: true, validator: {
if (it == null || it == '') {
return true
} else {
return (User.countByEmailAddress(it) > 0 && User.countByAltEmailAddress(it) > 0)
}
}
堆栈跟踪:
Testcase: testFindValidEmailAddress took 0.429 sec Caused an ERROR null java.lang.StackOverflowError at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36)
altEmailAddress(blank: true, nullable: true, validator: {
if (it == null || it == '') {
return true
} else {
return (User.countByEmailAddress(it) > 0 && User.countByAltEmailAddress(it) > 0)
}
}
Stack trace:
Testcase: testFindValidEmailAddress took 0.429 sec Caused an ERROR null java.lang.StackOverflowError at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36) at com.clearlyINNOVATIVE.model.User$__clinit__closure7_closure13.doCall(User.groovy:36)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用 withNewSession - 请参阅 http://adhockery.blogspot.com /2010/01/upgrading-grails-11-12.html
编辑:为 1.1.x 添加:
如果您尚未使用 1.2 并且 withNewSession() 不可用,您可以自己将其连接到引导程序:
You should use withNewSession - see http://adhockery.blogspot.com/2010/01/upgrading-grails-11-12.html
Edit: added for 1.1.x:
If you're not using 1.2 yet and withNewSession() isn't available, you can wire it up yourself in BootStrap: