From: Brad H. <bra...@sp...> - 2007-04-21 02:37:32
|
So here is ERCStatic.staticClazz().takeStaticStoredValueForKey (editingContext, value, key) public static void takeStaticStoredValueForKey (EOEditingContext editingContext, String value, String key) { ERCStatic entry = ERCStatic.staticClazz ().objectMatchingKey(editingContext,key); if (entry==null) { entry=(ERCStatic) ERXEOControlUtilities.createAndInsertObject(editingContext, "ERCStatic"); entry.setKey(key); } entry.setValue(value); } When it checks for an existing entry that needs to be updated it calls the version of objectMatchingKey() that uses the cache to get the value. Now since we are going to be inserting or updating value, shouldn't we instead call objectMatchingKey() _without_ using the cache? By using the cache we dramatically increase our chances of having the insert fail (because some other instance has recently inserted the value) or the update fail (the value attr is used for locking). Does anyone have any problems with me changing this line: ERCStatic entry = ERCStatic.staticClazz ().objectMatchingKey(editingContext,key); // noCache == false To ERCStatic entry = ERCStatic.staticClazz ().objectMatchingKey(editingContext,key, true/*noCache*/); ? Or is the current behavior more desirable? thanks, brad |