Hibernate Query problem with Informix

独自空忆成欢 提交于 2019-12-20 03:38:07

问题


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.


回答1:


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-1126

The solution seems to remove the parameter DELIMIDENT=y from the datasource URL.




回答2:


You meant this query:

FROM User

Because the select tag in HQL doesn't have to be specified when you want to retrieve all the properties of the object.



来源:https://stackoverflow.com/questions/7444426/hibernate-query-problem-with-informix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!