Class DbUtility

    • Constructor Detail

      • DbUtility

        public DbUtility()
    • Method Detail

      • getUnderlyingSQLException

        public static Throwable getUnderlyingSQLException​(Throwable throwable)
        This method will take care of finding the real underlying exception. When a jdbc or hibernate exception occurs then the whole stack trace is not available in the log because the exception does not return the underlying exception using the Throwable.getCause() but using the SQLException.getNextException().
        Parameters:
        throwable - the throwable to analyze
        Returns:
        the underlying sql exception or the original throwable if none found
      • readFile

        public static String readFile​(File file)
        Reads a file and returns the content as a String. The file must exist otherwise an OBException is thrown.
        Parameters:
        file - the file to read
        Returns:
        the content of the file