code: public Object getId(final Object entity) {
          Object unwrapped = entity;
          if (unwrapped == null) {
              return null;
          }
          unwrapped = ProxyHelper.unwrap(unwrapped);
          try {
              final MappedClass mappedClass = getMappedClass(unwrapped.getClass());
              if (mappedClass != null) {
                  final Field idField = mappedClass.getIdField();
                  if (idField != null) {
                      return idField.get(unwrapped);
                  }
              }
          } catch (Exception e) {
              LOG.error(e.getMessage(), e);
          }
          return null;
      }
docs: Gets the ID value for an entity
  
  @param entity the entity to process
  @return the ID value