[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5936) unexpected AST node on HQL UPDATE with composite ID

Kevin Ferrare (JIRA) noreply at atlassian.com
Fri Feb 18 03:59:05 EST 2011


unexpected AST node on HQL UPDATE with composite ID
---------------------------------------------------

                 Key: HHH-5936
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5936
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
            Reporter: Kevin Ferrare


I am trying to execute the following simple HQL update :
UPDATE ProductStorage SET id=:newId WHERE id=:oldId

id is a composite id (composed of "code" and "saleOfficeId")

I get the following exception :
unexpected AST node: AND

I think the cause is that when hibernate tries to split the id in the SET clause, it uses an "AND" instead of a comma

Here is the generated tree that fails (trace log) :

 \-[UPDATE] UpdateStatement: 'UPDATE'  querySpaces ("product_3f")
    +-[FROM] FromClause: 'FROM' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[], fromElementByTableAlias=[productsto0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
    |  \-[FROM_FRAGMENT] FromElement: '"product_3f"' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName="product_3f",tableAlias=productsto0_,origin=null,columns={,className=dto.ProductStorage}}
    +-[SET] SqlNode: 'SET'
    |  \-[AND] BinaryLogicOperatorNode: 'AND'
    |     +-[EQ] BinaryLogicOperatorNode: '='
    |     |  +-[SQL_TOKEN] SqlFragment: '"code"'
    |     |  \-[SQL_TOKEN] SqlFragment: '?'
    |     \-[EQ] BinaryLogicOperatorNode: '='
    |        +-[SQL_TOKEN] SqlFragment: '"saleOfficeId"'
    |        \-[SQL_TOKEN] SqlFragment: '?'
    \-[WHERE] SqlNode: 'WHERE'
       \-[AND] BinaryLogicOperatorNode: 'AND'
          +-[EQ] BinaryLogicOperatorNode: '='
          |  +-[SQL_TOKEN] SqlFragment: '"code"'
          |  \-[SQL_TOKEN] SqlFragment: '?'
          \-[EQ] BinaryLogicOperatorNode: '='
             +-[SQL_TOKEN] SqlFragment: '"saleOfficeId"'
             \-[SQL_TOKEN] SqlFragment: '?'


-- 
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

        


More information about the hibernate-issues mailing list