java - Problems updating using a subquery (join to the same table) using HQL over a MySQL database. -



java - Problems updating using a subquery (join to the same table) using HQL over a MySQL database. -

i trying should easy update set-up work in hibernate (using hql) on mysql database. there other threads out there in regards errors similar have encountered nil speaks same exact problem.

the update trying update row info row in same table. nil special here , have similar version working in mysql using toad.

it understanding hql not inner joins updates , sub-query used instead - have right?

well anyways, below first version of update worked with. threw error message "invalid path: 'tbb.column1'" , looking @ below not sure problem lies.

update tablea tba set tba.column1 = tbb.column1 tba.operationalid = (select tbb.operationalid tablea tbb tba.operationalid = tbb.operationalid) , tba.column2 = 1

further researching issue, replaced above listed 'set' statement straight assignment of value tba.column1 , encountered different error listed below.

error = "you can't specify target table 'tablea' update in clause"

update tablea tba set tba.column1 = 1 tba.operationalid = (select tbb.operationalid tablea tbb tba.operationalid = tbb.operationalid) , tba.column2 = 1

if can point me in right direction appreciated - not sure if sql needs farther adjusted run in hibernate.

thank in advance.

mysql supports join in update. i'm not sure if hibernate does:

update tablea tba bring together tablea tblb on tba.operationalid = tbb.operationalid set tba.column1 = tbb.column1 tba.column2 = 1;

java mysql sql hibernate hql

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -