code: private static Field findIdField(final Object value) {
          Field res = null;
          final Class<?> type = value.getClass();
          if (ODatabaseRecordThreadLocal.instance().isDefined()) {
              res = OObjectEntitySerializer.getIdField(type);
          } else {
              final String idField = OObjectSerializerHelper.getObjectIDFieldName(value);
              if (idField != null) {
                  try {
                      res = type.getDeclaredField(idField);
                  } catch (NoSuchFieldException e) {
                      LOGGER.warn(String
                              .format("Id field '%s' not found in class '%s'.", idField, type.getSimpleName()), e);
                  }
              }
          }
          return res;
      }
docs: Core orient field resolve method relies on bound connection, but it may be required to resolve
  id outside of transaction. So we use orient method under transaction and do manual scan outside
  of transaction.
  
  @param value object instance (non proxy)
  @return object id field or null if not found