* call {@link #addObject(EOEnterpriseObject)} on it.
* @param key the key of the object that was not found in the cache
*/
protected void handleUnsuccessfullQueryForKey(Object key) {
if (!_fetchInitialValues) {
ERXExpiringCache cache = cache();
// The other methods are synchronized on cache and then lock the EC. If we do it backwards,
// we can get a deadly embrace.
synchronized (cache) {
ERXEC editingContext = editingContext();
editingContext.lock();
try {
NSArray<T> objects = fetchObjectsForKey(editingContext, key);
if (objects.count() == 0) {
cache.setObjectForKey(createRecord(NO_GID_MARKER, null), key);
}
else if (objects.count() == 1) {
T eo = objects.objectAtIndex(0);
addObject(eo);
}