From: Lukas B. (JIRA) <no...@at...> - 2006-01-26 10:42:18
|
HQL insert into ... select ... statement problem due to lacking table alias= es in select clause ---------------------------------------------------------------------------= ------------------- Key: HHH-1397 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH= -1397 Project: Hibernate3 Type: Bug Components: hql =20 Versions: 3.1.1 =20 Environment: 3.1.1., PostgresSQL Reporter: Lukas Barton I have got problem with INSERT INTO ... SELECT ... As I have very complex table stucture and join many tables easy workaround = is not possible :-( I have SQL like this: insert into IdfKlient (dotazID,tabulkaVSabloneID,obec,status,metaTypKlienta= ,ulice,ic,psc,rc,jmeno,idKlient) select dotaz.id,sablonaMain.id,dtaklient.o= bec,dtaklient.status,dtaklient.metaTypKlienta,dtaklient.ulice,dtaklient.ic,= dtaklient.psc,dtaklient.rc,dtaklient.jmeno,dtaklient.idKlient from DtaKlien= t as dtaklient,Dotaz as dotaz,TabulkaVSablone as sablonaMain, HodnotaParame= truDotazuString parametr_0 where sablonaMain.id=3D:sablona_id and exists(fr= om Sablona as sablona where dotaz.sablona=3Dsablona and sablona.hlavniTabul= ka=3DsablonaMain and exists(from IdfDavka as davka where dotaz.davka=3Ddavk= a and davka.status=3D:status)) and parametr_0.dotaz=3Ddotaz and dtaklient.r= c=3Dparametr_0.hodnota and exists (from Parametr as param where param=3Dpar= ametr_0.parametr) But hibernate translates it into this (see where at the and of statement - = where idsablona=3Did and hlavnitabulka=3Didtabulkavsablone......): insert into idfklient ( dotaz_id, sablona_id, obec, status, metatypklienta_= id, ulice, ic, psc, rc, jmeno, idklient ) select dotaz1_.id as col_0_0_, ta= bulkavsa2_.idtabulkavsablone as col_1_0_, dtaklient0_.obec as col_2_0_, dta= klient0_.status as col_3_0_, dtaklient0_.metatypklienta_id as col_4_0_, dta= klient0_.ulice as col_5_0_, dtaklient0_.ic as col_6_0_, dtaklient0_.psc as = col_7_0_, dtaklient0_.rc as col_8_0_, dtaklient0_.jmeno as col_9_0_, dtakli= ent0_.idklient as col_10_0_ from dtaklient dtaklient0_, dotaz dotaz1_, tabu= lkavsablone tabulkavsa2_, hodnotaparametrudotazustring hodnotapar3_ inner j= oin hodnotaparametrudotazu hodnotapar3_1_ on hodnotapar3_.idhodnoty=3Dhodno= tapar3_1_.id where idtabulkavsablone=3D? and (exists (select sablona4_.id f= rom sablona sablona4_ where idsablona=3Did and hlavnitabulka=3Didtabulkavsa= blone and (exists (select idfdavka5_.ID from IDFDAVKA idfdavka5_ where idda= vky=3DID and STATUS=3D?)))) and iddotazu=3Did and rc=3Dhodnota and (exists = (select parametr6_.id from parametr parametr6_ where id=3Didparametru)) I found similar error here: http://opensource2.atlassian.com/projects/hiber= nate/browse/HHH-1349 --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators= .jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |