Hi Paul, I have prepared test case to demonstrate issue. Problem is if there is enabled cache in json based entity store. Entities could be in wrong state.
see here : https://github.com/apache/zest-qi4j/pull/2 to make test success, fix : JSONEntityState void cloneStateIfGlobalStateLoaded() { if( ! isStateNotCloned() ) there is one more fix needed in JSONMapEntityStoreMixin#fetchCachedState method . Note: I was not able to configure entity store with cache service in one layer , probably because of circular dependency: store uses cache, cache need store for config . cheers, Tibor On Jul 23, 2015, at 1:49 PM, Paul Merlin <[email protected]> wrote: > Hi Tibor, > > Tibor Mlynarik a écrit : >> Hi, >> >> I have noticed code in JSONEntityState that seems suspicious for me. >> >> In method JSONEntityState#cloneStateIfGlobalStateLoaded >> if parts are swapped. >> >> I suppose that by global state is meant copy taken from cache that is shared >> across UoWs. >> And before first entity change own copy for UoW should be cloned. >> >> But as it is now, cloning is not done at first change and redundantly >> executed with each entity change. >> Also maybe whole cloning could be avoided if cache is not used. >> >> Or am I wrong in understanding of purpose of this state clone ? > IIRC this is the sole purpose of this state clone. > As you pointed out there may be room for improvements here. > > Niclas, WDYT? > > /Paul >
