Informix 的 Hibernate 查询问题
我已经使用 Seam 2.2.1 和 Seam 编写了一个应用程序。 MySQL 正在运行。我现在尝试将应用程序连接到 Informix,当我从 hibernate 执行查询时(从用户用户中选择用户
),我得到了以下例外情况:
org.hibernate.exception.genericjdbcException无法执行查询
当我执行查询 select user.id,user.name from User user
时,
它已成功执行。生成的sql是
选择 前2个user0_.USER_ID为USER1_120_, user0_.dateOfBirth 为 dateOfBi2_120_, user0_.enabled为enabled120_, user0_.forename 为forename120_, user0_.password为password120_, user0_.surname 为 surname120_, user0_.userName 为 userName120_ 从 anetidb.用户 user0_ 在哪里 用户名=?
异常的堆栈跟踪:
12:00:24,407 INFO [IntegerType] 无法从结果集中读取列值:USER1_120_;没有这样的列名 12:00:24,665 警告 [JDBCExceptionReporter] SQL 错误:-79738,SQLState:IX000 12:00:24,873 错误 [JDBCExceptionReporter] 没有这样的列名
并且我使用 org.hibernate.dialect.InformixDialect 作为 hibernate.dialect
您对这个问题有想法吗?
感谢帮助。
I have written an application using Seam 2.2.1 & MySQL which is working. I am now trying to connect the application to Informix and when I execute a query from hibernate(select user from User user
) I am getting the following exceptions:
org.hibernate.exception.genericjdbcexception could not execute query
when i execute a query as select user.id,user.name from User user
it's executed successefuly.
The Generated sql is
select
first 2 user0_.USER_ID as USER1_120_,
user0_.dateOfBirth as dateOfBi2_120_,
user0_.enabled as enabled120_,
user0_.forename as forename120_,
user0_.password as password120_,
user0_.surname as surname120_,
user0_.userName as userName120_
from
anetidb.user user0_
where
username=?
The Stacktrace of exception:
12:00:24,407 INFO [IntegerType] could not read column value from result set: USER1_120_; No such column name
12:00:24,665 WARN [JDBCExceptionReporter] SQL Error: -79738, SQLState: IX000
12:00:24,873 ERROR [JDBCExceptionReporter] No such column name
And i Use org.hibernate.dialect.InformixDialect as hibernate.dialect
Have you an idea about the problem?
Thks For Help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
谷歌搜索“No such column name”informix hibernate让我找到了以下Hibernate错误报告,它描述了完全相同的问题:https://hibernate.onjira.com/browse/HBX-1126
该解决方案似乎从数据源 URL。
Googling for
"No such column name" informix hibernate
has led me to the following Hibernate bug report, which describes exactly the same problem: https://hibernate.onjira.com/browse/HBX-1126The solution seems to remove the parameter DELIMIDENT=y from the datasource URL.
您的意思是这个查询:
因为当您想要检索对象的所有属性时,不必指定 HQL 中的 select 标记。
You meant this query:
Because the select tag in HQL doesn't have to be specified when you want to retrieve all the properties of the object.