Daniel Keir Haywood created CAUSEWAY-3675:
---------------------------------------------

             Summary: Suppress autoflush if called by EntityChangeTracker (to 
avoid concurrent modification exceptions).
                 Key: CAUSEWAY-3675
                 URL: https://issues.apache.org/jira/browse/CAUSEWAY-3675
             Project: Causeway
          Issue Type: New Feature
          Components: Persistence (commons)
    Affects Versions: 2.0.0-RC4
            Reporter: Daniel Keir Haywood
            Assignee: Daniel Keir Haywood
             Fix For: 2.0.0-RC5


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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to