Resolution: Won't Fix
Affects Version/s: 7.0.X, 7.1.X, Master
Fix Version/s: None
Component/s: Core Infrastructure > ORM
Objects cached in EntityCache are just a representation of the Hibernate session object. That can cause, when calling a service that updates an object with a mvccVersion field and returns the cached modified object, that the returned object is obsolete.
Steps to Reproduce:
- Execute the following script:
No exception should be printed
An exception due to being the object stale is printed.
The reason strives in the fact that the entity cached object is a representation of Hibernate session object. When exiting the service method the commit gets done the mvccVersion gets incremented. We change in MVCCSynchronizerPostUpdateEventListener the cached object, but not the one that is already returned. So if we try to modify it afterwards we aren't going to be able because is obsolete.