I will create a JIRA for this issue and then write a unit test that exposes the issue along with a patch that fixes it up. The fixes are already in place for us, so it will just be a matter of the unit test. For interest sake, here are the few lines that show the issue:
DelegatorImpl -> store(GenericValue value, ...) (line 2527) this.clearCacheLine(value); Cache -> remove(GenericEntity entity) (line 114+) GenericValue oldEntity = entityCache.remove(entity.getPrimaryKey()); entityListCache.storeHook(entity, null); entityObjectCache.storeHook(entity, null); AbstractEntityConditionCache -> storeHook(..., List<T1> oldValues, ...) (line 197+) Iterator<T1> oldValueIter = oldValues.iterator(); while (oldValueIter.hasNext() && !shouldRemove) { T1 oldValue = oldValueIter.next(); if (condition.mapMatches(getDelegator(), oldValue)) { A jumped a few of the methods in the callstack, but suffice to say the delegator passes in the modified entity, the cache takes it and provides it to storeHook, and the storeHook parameter expects it is the oldValue. The iteration is doing a condition.mapMatches against these (actually) modified values and as a result, does not find a match ... so the condition is ok ... so it is not flushed from the cache. You may be wondering if we can just have Cache -> remove pass in the oldEntity from the entityCache.remove call. The trouble is that in a lot of cases the entity list that is retrieved contains a pile of entities that (themselves) may have never been independantly cached. My "hack" was to check for null here and then do a delegator.findByPrimaryKey to grab the real old one and go with that. Naturally we do not want the overhead of re-retrieving the entity again - hence the original comment. :) I will cut the JIRA now and should be able to work out the solution either tomorrow or on Monday (EST). Thanks! Bob David E Jones-4 wrote: > > > The GenericEntity object keeps a Map with original values if it was > loaded from the database and then changed, so you should be able to > use that (it does seem weird that it isn't used already!). > > -David > > -- View this message in context: http://www.nabble.com/EntityList-cache-issues-...-tp25179637p25208262.html Sent from the OFBiz - Dev mailing list archive at Nabble.com.