Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-3675

Suppress autoflush if called by EntityChangeTracker (to avoid concurrent modification exceptions).

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.0-RC4
    • 2.0.0
    • Persistence (commons)
    • None

    Description

      The following observed under JDO...

      Parent <->* Child as a 1:m managed relationship.

      there are lots of derived properties on the Parent

      create a new child object; as it is flushed, then JDO calls back to add the child to the parent's children collection.  This is done in RelationshipManagerImpl#process  (one of these per entity dirties in the xactn).

      The JDO lifecycle callbacks result in EntityChangeTracker being called.  This iterates over all properties (or at least those with @Property(entityChangePublishing = ENABLED) implicitly or explicitly.  Some of these may be derived, resulting in a call to RepositoryServiceDefault.  It has an autoFlush which will cause the transaction to be flushed.

      However, JDO is not re-entrant in this respect, and so hits a ConcurrentModificationException upon itself.

       

      ~~~

      As things stand currently there are two workarounds: either disable autoFlush for repository, or use @Property(entityChangePublishing=...).  

      This ticket is to introduce a new option, which is to automatically suppress autoflush when EntityChangeTracker is called.

      In addition, move RepositoryServiceDefault into persistence.commons, and update the location of its 'disable-auto-flush' property, and introduce a new config property to control this new behaviour.

      Attachments

        Issue Links

          Activity

            People

              danhaywood Daniel Keir Haywood
              danhaywood Daniel Keir Haywood
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: