code: @SuppressWarnings("unchecked")
      @Transactional
      public Comparable<Object> getVersion(E entity) {
          EntityType<E> entityType = entityManager.getMetamodel().entity(type);
          if (!entityType.hasVersionAttribute()) {
              return null;
          }
          return (Comparable<Object>) jpaUtil.getValue(entity, getVersionAttribute(entityType));
      }
docs: /*
  Return the optimistic version value, if any.