Uploaded image for project: 'Hibernate ORM'
  1. HHH-12826

Persist cascade of collection fails when orphan removal enabled with flush mode commit.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.0.Final, 5.3.1, 5.3.2
    • Fix Version/s: 5.3.3, 5.4.0.CR1
    • Environment:
      <spring.boot.version>2.0.0.RELEASE</spring.boot.version>
      <h2db.version>1.4.191</h2db.version>
      <hibernate.version>5.3.2.Final</hibernate.version>
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Worked in:
    • Last commented by a user?:
      true
    • Sprint:

      Description

      I trying to update version of hibernate from 5.2.12 to 5.3.2
      When persisting parent-child, one-to-many relationship with cascade-all and orphan-removal true, the following HibernateException is thrown:

      Caused by: org.hibernate.HibernateException: Don't change the reference to a collection with delete-orphan enabled : su.axada.hibernate.sandbox.model.DocumentA.lines
      

      Exception is throwing only if flushMode = COMMIT, if I'll set it to AUTO exception will gone.

      One more important thing is: I use envers if I'll remove @Audited annotation then no matter what value has flushMode and exception will gone.

      I think that the successful persisting of an object should not depend on the value of flushMode when using envers.

      In attachment you can find test ceses in class JPAUnitTestCase

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: