public void setDeleted ( DbEntity dbEntity ) { CachedDbEntity cachedEntity = getCachedEntity ( dbEntity ) ; if ( cachedEntity != null ) { if ( cachedEntity . getEntityState ( ) == TRANSIENT ) { cachedEntity . setEntityState ( DELETED_TRANSIENT ) ; } else if ( cachedEntity . getEntityState ( ) == PERSISTENT ) { cachedEntity . setEntityState ( DELETED_PERSISTENT ) ; } else if ( cachedEntity . getEntityState ( ) == MERGED ) { cachedEntity . setEntityState ( DELETED_MERGED ) ; } } else { // put a deleted merged into the cache CachedDbEntity cachedDbEntity = new CachedDbEntity ( ) ; cachedDbEntity . setEntity ( dbEntity ) ; cachedDbEntity . setEntityState ( DELETED_MERGED ) ; putInternal ( cachedDbEntity ) ; } }
Sets an object to a deleted state . It will not be removed from the cache but transition to one of the DELETED states depending on it s current state .