Hi
I am using Hibernate 3.4 togehter with Eclipse EMF Teneo.
While I have no problems with PostgreSQL and MSSQL, I have the following issue using DB2 with the DB2Dialect:
select count(this_."id") as y0_ from ( select id, icon, description, name, active, sorthint, basiccode_parent_id, 1 as clazz_ from "code" union all select id, icon, description, name, nullif(0,0) as active, sorthint, basiccode_parent_id, 2 as clazz_ from "category" ) this_ where this_."id"=?
When the this statement is executed I get the following error:
[IBM][CLI Driver][DB2/NT] SQL0206N "ID" ist in dem verwendeten Kontext ungültig. SQLSTATE=42703
I found out, that in the SELECT of the table 'code' the columnname id is not places in quotes.
If I change the query to
select count(this_."id") as y0_ from ( select "id", icon, description, name, active, sorthint, basiccode_parent_id, 1 as clazz_ from "code" union all select id, icon, description, name, nullif(0,0) as active, sorthint, basiccode_parent_id, 2 as clazz_ from "category" ) this_ where this_."id"=?
I get the error: [IBM][CLI Driver][DB2/NT] SQL0206N "ICON" ist in dem verwendeten Kontext ungültig. SQLSTATE=42703
As soon as all columnnames are quoted the statement can be executed without error:
select count(this_."id") as y0_ from ( select "id", "icon", "description", "name", "active", "sorthint", "basiccode_parent_id", 1 as clazz_ from "code" union all select "id", "icon", "description", "name", nullif(0,0) as active, "sorthint", "basiccode_parent_id", 2 as clazz_ from "category" ) this_ where this_."id"=?
My question is: How can I force Hibernate to put the column names in the FROM part also in quotes like it does with Column names in the SELECT part of the statement?
Thank you for your help. Peter Henzler
|