.executeUpdate() Wrong SQL translation
---------------------------------------
Key: HHH-2733
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2733
Project: Hibernate3
Issue Type: Bug
Components: core
Environment: hibernate3
Reporter: Giuseppe Manara
I set :
Query myQuery = mySession.createQuery("update antiric.elaborazioni.model.ArcuniA aa
set aa.aunCanDes = (select distinct can.canDes from antiric.tabelle.model.TabCan can,
antiric.tabelle.model.TabCsi csi where can.idCanCsi=csi.id and can.canCod=aa.aunTcan and
csi.csiCod=aa.aunTcsi) where aa.aunCanDes is null and aa.aunTipSta=1");
...
When I do :
myQuery.executeUpdate();
I get
org.hibernate.exception.SQLGrammarException: could not execute update query
org.postgresql.util.PSQLException: ERROR: column reference "id" is ambiguous
!!!!!!
the sql property of the SQLGrammarException is:
"update ARCUNIA set aunCanDes=(select distinct tabcan1_.canDes from TABCAN tabcan1_,
TABCSI tabcsi2_ where idCanCsi=id and canCod=aunTcan and csiCod=aunTcsi) where (aunCanDes
is null) and aunTipSta=?"
... as you can see,
my original " .. can.idCanCsi=csi.id .." is converted into "..
idCanCsi=id .." and that's why the error
P.S.:
nothing to do with the JOIN .. ON clause ; it seems not supported from
.createQuery("..")
best reguards,
giuseppe
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira