[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HHH-5166) Inconsistent session state with merge/evict on cascade="all" association

Alexandre FRADIN (JIRA) noreply at atlassian.com
Tue Apr 27 16:42:33 EDT 2010


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

Alexandre FRADIN edited comment on HHH-5166 at 4/27/10 3:40 PM:
----------------------------------------------------------------

In fact, I don't want to persist these changes. 

In my application, I set flushMode to Manual before merging in order to do not flush.
I need to merge my entity to access lazy collections and perform validations.

I expected that evicting the entity before the flush would cancel insert and update operations. 
Update operations are cancelled, but not the insert ones, it's a bit strange... If we can't merge and evict an object without flushing updates, update should cause this exception as well (in my opinion).

Is it a way to do that (merge and evict without flushing)?


Thanks.

      was (Author: keeg):
    In fact, I don't want to persist these changes. 

In my application, I set flushMode to Manual before merging in order to do not flush.
I need to merge my entity to access lazy collections and perform validations.

I expected that that evicting the entity before the flush would cancel insert and update operations. 
Update operations are cancelled, but not the insert ones, it's a bit strange... If we can't merge and evict an object without flushing updates, update should cause this exception as well (in my opinion).

Is it a way to do that (merge and evict without flushing)?


Thanks.
  
> Inconsistent session state with merge/evict on cascade="all" association
> ------------------------------------------------------------------------
>
>                 Key: HHH-5166
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5166
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.2, 3.5.1
>         Environment: Reproducted on :
> Hibernate-core 3.3.2 and 3.5.1-Final
> DB2 and HSQL DB
> with annotation and classic hbm mapping
>            Reporter: Alexandre FRADIN
>            Assignee: Gail Badner
>            Priority: Critical
>         Attachments: hibernate-test-merge-evict-cascade-all.zip
>
>
> My apologies for my English.
> I have entities User and Role  with a many-to-many association mapped with cascade="all". So merge and evict operations on User should be applied to this association. 
> When I do the following : 
> 1) create user u existing in DB
> 2) add a new Role r to this user (this Role don't exists in DB)
> 3) merge u 
> 4) evict the instance returned by the merge operation
> 5) use the same session for any operation
> 6) commit the session
> I get this exception : "org.hibernate.AssertionFailure: possible nonthreadsafe access to session".
> There is no thread issue. I think this is a standard way to use merge and evict operations.
> I think that merge and evict operations used on modified entities leave the session in an inconsistent state.
> See unit test wich reproduct this bug.
> Does a workaround exist for this bug?
> Regards.

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