-->
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 mit DB2
PostPosted: Mon May 31, 2010 5:33 am 
Newbie

Joined: Mon May 31, 2010 5:16 am
Posts: 2
Hallo

Ich verwende Hibernate 3.3.2 zusammen mit Eclipse EMF Teneo.

Während mti PostgreSQL und MSSQL alles perfekt funktioniert, habe ich bei der Verwendung von DB2 mit dem DB2Dialect folgendes Problem:

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"=?

Beim Ausführen von obigem Statement gibt es folgenden Fehler:

[IBM][CLI Driver][DB2/NT] SQL0206N "ID" ist in dem verwendeten Kontext ungültig. SQLSTATE=42703

Ich fand heraus, dass der Fehler daran liegt, dass beim Select der Tabelle 'code' der Spaltenname id nicht in Anführungszeichen steht.

Denn wenn ich die Abfrage ändere auf

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"=?

bekomme ich die Meldung
[IBM][CLI Driver][DB2/NT] SQL0206N "ICON" ist in dem verwendeten Kontext ungültig. SQLSTATE=42703

Sobald ich alle Spaltennamen in Anführungszeichen setzte kann die Abfrage ohne Probleme ausgeführt werden:

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"=?

Meine Frage lautet also:
Wie bringe ich Hibernate dazu auch spaltennamen in solchen union statements in Anführungszeichen zu setzen?

Vielen Dank im vorraus
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.