public void lock(Object entity, LockModeType lockModeType, Map<String, Object> properties) {
    checkOpen();
    LockOptions lockOptions = null;
    if ( !isTransactionInProgress() ) {
      throw new TransactionRequiredException( "no transaction is in progress" );
    }
    try {
      if ( !contains( entity ) ) {
        throw new IllegalArgumentException( "entity not in the persistence context" );