@Override
  public final AnonimoTO searchByUsername(final String username) {
    Connection con = MySqlConnectionFactory.getConnection();

    PreparedStatement statement = null;
    AnonimoTO anonimo = new AnonimoTO();
    ResultSet result = null;

    try {
      statement = con.prepareStatement(sqlFac.getQuery("ResearchUserByName"));

      statement.setString(1, username);

      result = statement.executeQuery();

      while (result.next()) {
        anonimo.username = result.getString("username");
        anonimo.tipo = result.getString("tipo");
        anonimo.agenziaId = result.getString("agenzia_id");
      }

    } catch (SQLException e) {
      handleExceptions(e, ErrorHandlerInt.FATAL);
    } finally {

      if (statement != null) {
        DbUtil.close(statement);
      }
      DbUtil.close(con);
    }
    return anonimo;
  }
  @Override
  public final Boolean accountExsist(final AnonimoTO dati) {

    Connection con = MySqlConnectionFactory.getConnection();

    PreparedStatement statement = null;
    Boolean response = false;

    try {

      statement = con.prepareStatement(sqlFac.getQuery("Autenticazione"));
      statement.setString(1, dati.username);
      statement.setString(2, dati.password);

      ResultSet rs = statement.executeQuery();

      if (rs.next()) {
        response = true;
      }

    } catch (SQLException e) {
      handleExceptions(e, ErrorHandlerInt.FATAL);
    } finally {
      if (statement != null) {
        DbUtil.close(statement);
      }
      DbUtil.close(con);
    }
    return response;
  }