code: public static OptimisticLockingException of(Throwable optimisticLockError) {
  
      if (optimisticLockError instanceof OptimisticLockingException) {
        return (OptimisticLockingException) optimisticLockError;
      }
      // ATTENTION: keep all these referenced qualified and prevent imports to avoid NoClassDefFoundError
      try {
        if (optimisticLockError instanceof org.hibernate.StaleObjectStateException) {
          return new OptimisticLockingExceptionHibernate((org.hibernate.StaleObjectStateException) optimisticLockError);
        }
      } catch (NoClassDefFoundError e) {
        // ignore
      }
      try {
        if (optimisticLockError instanceof javax.persistence.OptimisticLockException) {
          return new OptimisticLockingExceptionJpa((javax.persistence.OptimisticLockException) optimisticLockError);
        }
      } catch (NoClassDefFoundError e) {
        // ignore
      }
      try {
        if (optimisticLockError instanceof org.springframework.orm.ObjectOptimisticLockingFailureException) {
          return new OptimisticLockingExceptionSpring((org.springframework.orm.ObjectOptimisticLockingFailureException) optimisticLockError);
        }
      } catch (NoClassDefFoundError e) {
        // ignore
      }
      return null;
    }
docs: Creates an {@link OptimisticLockingException} for the given {@link Throwable} cause.
  
  @param optimisticLockError a {@link Throwable} like {@link org.hibernate.StaleObjectStateException},
  {@link javax.persistence.OptimisticLockException}, or
  {@link org.springframework.orm.ObjectOptimisticLockingFailureException}.
  @return the wrapped {@link OptimisticLockingException} or {@code null} if the given {@link Throwable} is
  not a known optimitisc locking exception.