code: private void checkOptimisticLockingState(Serializable id, EntityKey key, Object object, Object[] loadedState, Object version,
  			SharedSessionContractImplementor session, Tuple resultset) {
  		int tableSpan = getTableSpan();
  		EntityMetamodel entityMetamodel = getEntityMetamodel();
  
  		boolean isImpliedOptimisticLocking = !entityMetamodel.isVersioned() && isAllOrDirtyOptLocking();
  
  		// Compare all the columns against their current state in the datastore
  		if ( isImpliedOptimisticLocking && loadedState != null ) {
  			// we need to utilize dynamic delete statements
  			for ( int j = tableSpan - 1; j >= 0; j-- ) {
  				boolean[] versionability = getPropertyVersionability();
  
  				//TODO do a diff on the properties value from resultset
  				GridType[] types = gridPropertyTypes;
  
  				for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
  					boolean include = isPropertyOfTable( i, j ) && versionability[i];
  					if ( include ) {
  						final GridType type = types[i];
  						final Object snapshotValue = type.nullSafeGet(
  								resultset, getPropertyColumnNames( i ), session, object
  						);
  						//TODO support other entity modes
  						if ( ! type.isEqual( loadedState[i], snapshotValue, getFactory() ) ) {
  							raiseStaleObjectStateException( id );
  						}
  					}
  				}
  			}
  		}
  		// compare the version column only
  		else if ( entityMetamodel.isVersioned() ) {
  			checkVersionAndRaiseSOSE( id, version, session, resultset );
  		}
  	}
docs: Performs an explicit check of the optimistic locking columns in case the current datastore does not support
  atomic find-and-update/find-and-delete semantics.
  <p>
  <b>Note:</b> Naturally, that approach is not completely fail-safe, it only minimizes the time window for
  undiscovered concurrent updates.