// Get the identity map by the entity class:
Map entityMap = this.lookupMap(updatedEntity.getClass());
// Look for the entity in the map and update it (if found):
Object currentEntity = entityMap.get(id);
if ((currentEntity != null) && (currentEntity.getClass().equals(updatedEntity.getClass()))) {
IdentityHashMap localIdentityMap = (IdentityHashMap) DefaultPrevalentSystem.localIdentityMap.get();
// If the object has still not been reached:
if (localIdentityMap.get(currentEntity) == null) {
// Add the actual entity to the thread local identity map, for tracking its traversal (an entity once traversed must not be tarversed again):
localIdentityMap.put(currentEntity, new Integer(1));
// Copy new into actual and do cascade persistence:
this.doCascadePersistence(updatedEntity, currentEntity);
}
// Return the updated (original) entity:
return currentEntity;