简体   繁体   English

使用旧式数据库SQL Server的Grails

[英]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.

相关问题 传统表使SQL Server的映射问题失败 - Legacy tables grails mapping issue with SQL Server 将旧版FlashFiler2数据库镜像到SQL Server - Mirroring legacy FlashFiler2 database to SQL Server Sql Server旧数据库到群集索引与否 - Sql Server Legacy Database To Clustered index or not 将旧数据库(MYSQL)导出到具有不同架构的不同数据库(SQL Server)中 - Exporting legacy database(MYSQL) into a Different Database(SQL Server) with a different Schema Azure SQL传统基数估计无法像SQL Server 2016一样工作 - Azure SQL Legacy Cardinality Estimation Not Working Like SQL Server 2016 在旧版SQL Server数据库中加密密码字段的简单方法 - Simple way to Encrypt Password Field in Legacy SQL Server Database 如何为旧版SQL Server数据库生成Rails应用程序模型和迁移? - How to Generate Rails App Models & Migrations for Legacy SQL Server Database? 用于包装旧版SQL Server数据库的最佳Ruby ORM? - Best Ruby ORM for Wrapping around Legacy SQL Server Database? HibernateException:在MS SQL旧版数据库上使用Grails 2.0.2的联接表缺少表错误 - HibernateException: Missing table error for a Join Table using Grails 2.0.2 on MS SQL legacy database sql 服务器中遗留的字符串聚合 - String aggregate in legacy in sql server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM