When the cachemode is set to CacheMode.GET and an entity is updated, the entity is not evicted from the cache. Therefore, when the entity is updated by another transaction afterwards, an exception occurs:
The problem might have to do with the execute-method in org.hibernate.action.internal.EntityUpdateAction (line 188).
The bug can be reproduced by project: https://github.com/topicusonderwijs/cachetest . When deployed, take the following steps:
Click on the New MyEntity-button. A new MyEntity-instance is inserted in the database;
Click on the Update last MyEntity-button. The last created MyEntity-instance is updated with CacheMode.GET;
Click on the Update last MyEntity-button. An error occurs.
Wildfly 17, infinispan cachce