HQL insert into ... select ... statement problem due to lacking table aliases in select clause
Description
relates to
Activity
Alain Coetmeur July 17, 2015 at 9:23 AM
there are others similar issues reported.
I have similar issue on 5.0.0.CR2 and 4.3.2.Final
Brett Meyer July 8, 2014 at 3:10 PM
Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!
Brett Meyer April 7, 2014 at 5:43 PM
In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.
If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.
Thank you!
Christian Bauer June 19, 2006 at 2:31 PM
This is not primary functionality. The regular Hibernate developers are currently busy with other things. If you want to see this fixed quicker, submit a patch.
Matan June 19, 2006 at 2:09 PM
My workaround is direct SQL (yuck!).... only thing that avoids the performance bottleneck.
Surprised we aren't getting any feedback from the team though...
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.obec,dtaklient.status,dtaklient.metaTypKlienta,dtaklient.ulice,dtaklient.ic,dtaklient.psc,dtaklient.rc,dtaklient.jmeno,dtaklient.idKlient from DtaKlient as dtaklient,Dotaz as dotaz,TabulkaVSablone as sablonaMain, HodnotaParametruDotazuString parametr_0 where sablonaMain.id=:sablona_id and exists(from Sablona as sablona where dotaz.sablona=sablona and sablona.hlavniTabulka=sablonaMain and exists(from IdfDavka as davka where dotaz.davka=davka and davka.status=:status)) and parametr_0.dotaz=dotaz and dtaklient.rc=parametr_0.hodnota and exists (from Parametr as param where param=parametr_0.parametr)
But hibernate translates it into this (see where at the and of statement - where idsablona=id and hlavnitabulka=idtabulkavsablone......):
insert into idfklient ( dotaz_id, sablona_id, obec, status, metatypklienta_id, ulice, ic, psc, rc, jmeno, idklient ) select dotaz1_.id as col_0_0_, tabulkavsa2_.idtabulkavsablone as col_1_0_, dtaklient0_.obec as col_2_0_, dtaklient0_.status as col_3_0_, dtaklient0_.metatypklienta_id as col_4_0_, dtaklient0_.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_, dtaklient0_.idklient as col_10_0_ from dtaklient dtaklient0_, dotaz dotaz1_, tabulkavsablone tabulkavsa2_, hodnotaparametrudotazustring hodnotapar3_ inner join hodnotaparametrudotazu hodnotapar3_1_ on hodnotapar3_.idhodnoty=hodnotapar3_1_.id where idtabulkavsablone=? and (exists (select sablona4_.id from sablona sablona4_ where idsablona=id and hlavnitabulka=idtabulkavsablone and (exists (select idfdavka5_.ID from IDFDAVKA idfdavka5_ where iddavky=ID and STATUS=?)))) and iddotazu=id and rc=hodnota and (exists (select parametr6_.id from parametr parametr6_ where id=idparametru))
I found similar error here: http://opensource2.atlassian.com/projects/hibernate/browse/HHH-1349