[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-548) many-to-many faulty delete optimization when filter in use

Tolga Tarhan (JIRA) noreply at atlassian.com
Wed Mar 10 21:32:49 EST 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35802#action_35802 ] 

Tolga Tarhan commented on HHH-548:
----------------------------------

The fix to this bug only works if the Filter is still enabled at flush time. It does not work in this scenario:

1) Enable the filter
2) Execute a query
3) Change the collection
4) Disabled the filter
5) Flush (manually or due to transaction commit)

However, the above case does seem to be a reasonable use case, especially in applications where Hibernate filters may be used to provide row-level security based on the logged-in user. In these cases, it's reasonable to use EJB or Spring interceptors to enable/disable the filter as appropriate. Due to the limitation above, such interceptors have to force a session.flush() before they disable the filter.

> many-to-many faulty delete optimization when filter in use
> ----------------------------------------------------------
>
>                 Key: HHH-548
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-548
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.0.3
>         Environment: Hibernate 3.0.3 (standalone from a JUnit test)
>            Reporter: Vincent Giguère
>            Assignee: Gavin King
>             Fix For: 3.1 beta 1
>
>
> Read post on forum: http://forum.hibernate.org/viewtopic.php?t=943013
> There is a faulty optimization for many-to-many delete statements when filters are in use.
> If a xxx-to-many association is loaded with filters turned on, that we remove every object from the association and then persist the parent object (with cascade on childs), the child delete SQL statement issued is:
> delete from association_table where parent_id=?
> This is not accurate since other associated childs might not have been loaded at first (and hence not deleted) because a filter was up. 
> The filter should probably be applied to the child table on the delete as well.
> Regards,
> Vincent Giguère

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