[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2408) Incorrect SQL generated for JPA QL Update statement involving multiple entities

Istvan Kovacs (JIRA) noreply at atlassian.com
Thu Feb 16 07:38:11 EST 2012


    [ https://hibernate.onjira.com/browse/HHH-2408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45526#comment-45526 ] 

Istvan Kovacs commented on HHH-2408:
------------------------------------

By which part of the JPA specification (*not* HQL!) is this 'not supported' (by JPA)?
http://download.oracle.com/otn-pub/jcp/persistence-2.0-fr-eval-oth-JSpec/persistence-2_0-final-spec.pdf

4.10 update_statement ::= update_clause [where_clause]
4.5 where_clause ::= WHERE conditional_expression
4.6 Conditional Expressions
4.6.3 Path Expressions
"It is illegal to use a collection_valued_path_expression within a WHERE or HAVING clause as part
of a conditional expression except in an empty_collection_comparison_expression, in a
collection_member_expression, or as an argument to the SIZE operator."

That is the only restriction on path expressions; the reported update's WHERE clause did not refer to a condition-valued path, so it does not apply. Therefore, the path expression in the WHERE clause is valid, I think.

Please let me know if I'm wrong, or if we can expect a fix for the issue (if it's valid).

Thanks,
Kofa

> Incorrect SQL generated for JPA QL Update statement involving multiple entities
> -------------------------------------------------------------------------------
>
>                 Key: HHH-2408
>                 URL: https://hibernate.onjira.com/browse/HHH-2408
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: query-hql
>    Affects Versions: 3.2.2
>         Environment: Hibernate 3.2.2 GA, Oracle 9i
>            Reporter: Alex Savitsky
>         Attachments: application.properties, Branch.java, Issue.java, log.txt, PersistentEntity.java, TestCase.zip, Visit.java
>
>
> When generating SQL for statements like this: UPDATE Issue i SET i.dueDate = i.dueDate + 10 WHERE i.visit.branch.id = :branchId, an extra comma is generated at the end of table list: update Issue,  set DUE_DATE=DUE_DATE+10 where BRANCH_ID=?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list