[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1657) hql update generate wrong sql with joined subclass hierarcy

John Baker (JIRA) noreply at atlassian.com
Fri Jul 11 10:24:14 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_30638 ] 

John Baker commented on HHH-1657:
---------------------------------

Interestingly, when I execute delete from Event where time < x, the following statements are produced:

Hibernate: insert into HT_Event select event0_.eventId as eventId from Event event0_ where time<?
Hibernate: delete from ISSO where (eventId) IN (select eventId from HT_Event)
Hibernate: delete from BasicLogin where (eventId) IN (select eventId from HT_Event)
Hibernate: delete from IWALogin where (eventId) IN (select eventId from HT_Event)
Hibernate: delete from Login where (eventId) IN (select eventId from HT_Event)
Hibernate: delete from Event where (eventId) IN (select eventId from HT_Event)
Hibernate: delete from HT_Event

I guess this could all be reduced to one statement:

delete from Event where time < ?


> hql update generate wrong sql with joined subclass hierarcy
> -----------------------------------------------------------
>
>                 Key: HHH-1657
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: query-hql
>         Environment: Hibernate 3.2.0cr1, Hibernate 3.1.3
>            Reporter: Alexey Romanchuk
>            Assignee: Gail Badner
>            Priority: Critical
>             Fix For: 3.2.x, 3.3.x
>
>
> Let suppose that we have two joined subclass entities: Parent (id PK) and Child (id PK) that mapped with joined subclass method.
> When I try to update Child by id with hql:
> update Child c set c.field = 'value' where c.id = 1234
> hibernate generates joined tables like 
> insert into HT_parent select child0_.id as id from child child0_ inner join parent child0_1_ on child0_.id=child0_1_.id  wher id in = 1234
> look at last condition. hibernate use id WITH OUT tables alias that cause sql exception: column reference "id" is ambiguous

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