[英]Grails working with legacy database SQL server
A simple Grails 1.3.7 applications with SQL server 2000. connection OK. 一个简单的带有SQL Server 2000的Grails 1.3.7应用程序。连接正常。 create new table OK.
创建新表,确定。 however, when trying to access existing tables, see error below.
但是,当尝试访问现有表时,请参见下面的错误。 Constraints: cannot change the existing data.
约束:无法更改现有数据。 Questions: what file is this error line [35] in?
问题:此错误行[35]位于哪个文件中? Is there any way to allow null object (eg NOT to get property 'id' when the object is null)?
有什么方法可以允许空对象(例如,当对象为空时不获取属性“ id”)?
Error 500:
Servlet: default
URI: /root0001/person/list
Exception Message: Cannot get property 'id' on null object
Caused by: Error evaluating expression [personInstance.id] on line [35]: Cannot get property 'id' on null object
Class: /person/list
At Line: [35]
Code Snippet:
Stack Trace
org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [personInstance.id] on line [35]: Cannot get property 'id' on null object
at person_list$_run_closure2_closure27.doCall(person_list:67)
at person_list$_run_closure2.doCall(person_list:60)
at person_list$_run_closure2.doCall(person_list)
at person_list.run(person_list:76)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException: Cannot get property 'id' on null object
at person_list$_run_closure2_closure27_closure34.doCall(person_list:67)
... 5 more
This is likely happening in your list.gsp, in the section that tries to render the personInstance Id. 这可能是在您的list.gsp中尝试呈现personInstance ID的部分中发生的。 You can use the Groovy safe dereference operator to hack past this, but you may want to investigate why your database is returning a null object for the list view.
您可以使用Groovy 安全取消引用运算符来解决这个问题,但是您可能想调查为什么数据库为列表视图返回空对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.