[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6612) org.hibernate.session.isDirty() flushes new rows in a Collection which has items mapped with id generator "identity"

Emre BAKKAL (JIRA) noreply at atlassian.com
Fri Aug 26 11:19:03 EDT 2011


org.hibernate.session.isDirty() flushes new rows in a Collection which has items mapped with id generator "identity"
--------------------------------------------------------------------------------------------------------------------

                 Key: HHH-6612
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6612
             Project: Hibernate Core
          Issue Type: Bug
          Components: annotations, core
    Affects Versions: 3.0 final
         Environment: Hibernate 3.0, MySql 5.5.11, JBoss 5.1, JBoss Seam 2.2.1
            Reporter: Emre BAKKAL
            Priority: Critical


If we call org.hibernate.session.isDirty() after we added a new row to a mapped collection in a managed Entity, dirty check forces an id assign and executes an insert.

I see that this behavior is caused by my collection items having id generator(annotated by javax.persistence.Id and javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.IDENTITY)) and mapped with cascade type "all"(javax.persistence.CascadeType.ALL), but still it's an unexpected behavior. Shouldn't it return true when it found a new row?

I couldn't find a workaround for this behavior. I wanted to give user a choice to save the changes or not, if there are changes which have been made.

Setting org.hibernate.FlushMode to "NEVER" does not help either.

This behavior prevents using this method for change tracking, and is not compatible with the description of the method..

Best Regards..

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