code: public static boolean isTemporaryTable(Connection connection, String tableReference) throws SQLException {
          TableLocation location = TableLocation.parse(tableReference);
          ResultSet rs = getTablesView(connection, location.getCatalog(), location.getSchema(), location.getTable());
          boolean isTemporary = false;
          try {
              if(rs.next()) {
                  String tableType;
                  if(hasField(rs.getMetaData(), "STORAGE_TYPE")) {
                      // H2
                      tableType = rs.getString("STORAGE_TYPE");
                  } else {
                      // Standard SQL
                      tableType = rs.getString("TABLE_TYPE");
                  }
                  isTemporary = tableType.contains("TEMPORARY");
              } else {
                  throw new SQLException("The table "+location+" does not exists");
              }
          } finally {
              rs.close();
          }
          return isTemporary;
      }
docs: Read INFORMATION_SCHEMA.TABLES in order to see if the provided table reference is a temporary table.
  @param connection Active connection not closed by this method
  @param tableReference Table reference
  @return True if the provided table is temporary.
  @throws SQLException If the table does not exists.