title: org.postgresql.util.PSQLException: The column name grupo was not found in this ResultSet. (DIFFERENT ERROR)
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8793399/org-postgresql-util-psqlexception-the-column-name-usuario-was-not-found-in-this">org.postgresql.util.PSQLException: The column name usuario was not found in this ResultSet</a>  </p>
  </blockquote>
  
  
  
  <p>I apologize for asking the question with the similar error. However, this one is different.</p>
  
  <p>So my database table for usuarios_grupos is the following:</p>
  
  <pre><code>usuario | grupo
  
  admin   | 1
  admin   | 1
  erion   | 5
  </code></pre>
  
  <p>My result set method is the following:</p>
  
  <pre><code>public Object objectFactory(ResultSet rs) {
          try {
              UsuariosGrupos usergroup = new UsuariosGrupos(rs.getString("usuario"), rs.getString("grupo"));
              return usergroup;
          } catch (SQLException e) {
              e.printStackTrace();
              // retorno do método
              return null;
          }
      }
  </code></pre>
  
  <p>The error appears at the same line:</p>
  
  <pre><code>ugList.add((UsuariosGrupos) objectFactory(rs));
  </code></pre>
  
  <p>in my List method:</p>
  
  <pre><code>public List&lt;UsuariosGrupos&gt; select() {
      //Colecao List recebe null
      List&lt;UsuariosGrupos&gt; ugList = null;
      try {
  
          //Conecta no banco
          conn.conectar();
          //Prepara o preparedStatment
          stmt = (PreparedStatement) conn.getPreparedStatement("select * from usuarios_grupos");
          //Executa a instrucao SQL
          ResultSet rs = stmt.executeQuery();
          ugList = new ArrayList&lt;UsuariosGrupos&gt;();
          //Enquanto ouver resultSet
          while (rs.next()) {
              ugList.add((UsuariosGrupos) objectFactory(rs));
          }
          System.out.println("################################UsuariosGrupos OK################################");
      } catch (SQLException e) {
          System.out.println("################################UsuariosGrupos Falhou################################");
          e.printStackTrace();
      } finally {
          conn.desconectar();
      }
      return ugList;
  }
  </code></pre>
  
  <p>This is my UsuariosGrupos model:</p>
  
  <pre><code>  public class UsuariosGrupos {
  
      private String usuario;
      private String grupo;
  
      public UsuariosGrupos() {
      }
  
      public UsuariosGrupos(String usuario, String grupo) {
          this.usuario = usuario;
          this.grupo = grupo;
      }
  
     public String getGrupo() {
          return grupo;
      }
  
      public void setGrupo(String grupo) {
          this.grupo = grupo;
      }
  
      public String getUsuario() {
          return usuario;
      }
  
      public void setUsuario(String usuario) {
          this.usuario = usuario;
      }
  
  
  }
  </code></pre>
  
  <p>I don't get it. My result set matches that of my database, and yet I am getting the error. Same letter-casing. Does anyone know what I've done wrong : /</p>
  
  <p>The usuario and grupo in my usuarios_grupos is a primary composite key. Do you think it might have anything to do with the error?? Thanks!</p>