title: Problems updating using a subquery (join to the same table) using HQL over a MySQL database.
body: <p>I am trying to get what should be an easy update to set-up to work in Hibernate (using HQL) over a MySQL database.  There 
  are other threads out there in regards to errors similar to what I have encountered but nothing that speaks to the same exact problem.</p>
  
  <p>The update I am trying to do is to update a row with information from another row in the same table. Nothing special here and I have a similar version working in MySQL using Toad.  </p>
  
  <p>It is my understanding that HQL does not like inner joins for updates and that a sub-query is to be used instead - do I have that right? </p>
  
  <p>Well anyways, below is the first version of the update I worked with.  This threw the error message 
  "Invalid path: 'tbB.column1'" and looking at the below I am not sure where the problem lies. </p>
  
  <pre><code>UPDATE tableA tbA
     SET tbA.column1 = tbB.column1
       WHERE tbA.operationalId =
            (SELECT tbB.operationalId FROM tableA AS tbB
              WHERE tbA.operationalId = tbB.operationalId)
     AND tbA.column2 = 1
  </code></pre>
  
  <p>Further researching this issue, I replaced the above listed 'set' statement with a straight 
  assignment of a value to tbA.column1 and encountered a different error which is listed below.  </p>
  
  <p>error = "You can't specify target table 'tableA' for update in FROM clause"</p>
  
  <pre><code>UPDATE tableA tbA
     SET tbA.column1 = 1
       WHERE tbA.operationalId =
            (SELECT tbB.operationalId FROM tableA AS tbB
              WHERE tbA.operationalId = tbB.operationalId)
     AND tbA.column2 = 1
  </code></pre>
  
  <p>If anyone can point me in the right direction that would be appreciated - I am not sure if the sql needs to be further adjusted to run successfully in Hibernate.</p>
  
  <p>Thank you in advance.    </p>