[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3337) Hibernate disregards @JoinTable when generating bulk UPDATE/DELETE for a self-joined entity

Alex Savitsky (JIRA) noreply at atlassian.com
Fri Jun 6 14:57:33 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Savitsky updated HHH-3337:
-------------------------------

    Attachment: TestHB.zip

Eclipse project with a Maven POM. Build and execute the test.Test class.

Notice that the generated DELETE SQL looks like this:

DELETE
FROM ElementMapping
WHERE NOT (EXISTS (SELECT headermapp1_.id
                   FROM HeaderMapping headermapp1_,
                        Unit unit2_,
                        Element element3_
                   WHERE ElementMapping.UNIT_ID = unit2_.id
                   AND   ElementMapping.ELEMENT_ID = element3_.id
                   AND   unit2_1_.TOP_HEAD_ID = headermapp1_.UNIT_ID
                   AND   element3_.HEADER_ID = headermapp1_.HEADER_ID));

where unit2_1_ is supposed to point to the LINK table, but it is missing. The real SQL should look like this (with the missing pieces marked with '->'):

DELETE
FROM ElementMapping
WHERE NOT (EXISTS (SELECT headermapp1_.id
                   FROM HeaderMapping headermapp1_,
                        Unit unit2_,
->                        Link unit2_1_,
                        Element element3_
                   WHERE ElementMapping.UNIT_ID = unit2_.id
                   AND   ElementMapping.ELEMENT_ID = element3_.id
->                   AND   unit2_1_.UNIT_ID = unit2_.ID
                   AND   unit2_1_.TOP_HEAD_ID = headermapp1_.UNIT_ID
                   AND   element3_.HEADER_ID = headermapp1_.HEADER_ID));

> Hibernate disregards @JoinTable when generating bulk UPDATE/DELETE for a self-joined entity
> -------------------------------------------------------------------------------------------
>
>                 Key: HHH-3337
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3337
>             Project: Hibernate3
>          Issue Type: Bug
>    Affects Versions: 3.2.6
>            Reporter: Alex Savitsky
>         Attachments: TestHB.zip
>
>
> When an entity is joined into itself using a join table, the generated SQL for an UPDATE/DELETE doesn't include this join table.

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