-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problem with DB2
PostPosted: Mon Jun 07, 2010 1:59 am 
Newbie

Joined: Mon May 31, 2010 5:16 am
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.