code: public <E> E updateWithOptimisticLock(E entity) {
      PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entity);
      if (versionMetadata == null) {
        return update(entity);
      } else {
        return updateWithOptimisticLockingInternal(entity, versionMetadata);
      }
  
    }
docs: Updates the given entity with optimistic locking, if the entity is set up to support optimistic
  locking. Otherwise, a normal update is performed.
  
  @param entity
  the entity to update
  @return the updated entity which may be different than the given entity.