When secondary caching(Redis) and transactions are opened, TransactionalCacheManager commits because entries ToAddOnCommit PutObject reads pojo's attribute method to obtain caches of other objects, which may result in ConcurrentModificationException of transactional Caches, with the following exceptions: MyBatis MyBatis TransactionalCacheManager problem

Whether use iterator instead of for loop in the commit method of TransactionalCacheManager。 like this:

public void commit() {
        Iterator it= this.transactionalCaches.values().iterator();

        while(it.hasNext()) {
            TransactionalCache txCache = (TransactionalCache)it.next();
            txCache.commit();
        }

    }

Comment From: harawata

Hi @huangqinghe ,

I'm sorry, but I couldn't follow your explanation. Please consider providing a repro like these.

And please paste text instead of an image whenever possible.

Comment From: harawata

No reply.