public static PSQLException extractPSQLException(Throwable exception){
  while (exception != null) {
    if (exception instanceof PSQLException) {
      return (PSQLException)exception;
    }
    exception=exception.getCause();
  }
  return null;
}

public static PSQLException extractPSQLException ( Throwable exception ) { while ( exception != null ) { if ( exception instanceof PSQLException ) { return ( PSQLException ) exception ; } exception = exception . getCause ( ) ; } return null ; }
extracts a psqlexception from an ormlite wrapped sqlexception . this is necessary in order to pull out sqlstate data
