title: PreparedStatement's setInt() not working on PostgreSQL
body: <p>I'm using PostgreSQL 9.1 with Tomcat 7 on Eclipse. The connection is made through a connection pool. When I use the <code>setInt()</code> method for the <code>PreparedStatement</code>, nothing is returned. When printing the prepared statement, the '?' is replaced by some weird String I suppose is a reference to the object. When I use the method <code>setObject()</code> with the appropriate <code>Type.INTEGER</code>, the printed statement contains the correct value, but as a String, and forcefully an Int is required.</p>
  <p>Here's the code:</p>
  <pre><code>public User_DTO[] select(User_DTO params, int order, int limit, int offset)
  {
      User_DTO result = null;
      ArrayList&lt;User_DTO&gt; result_arr = new ArrayList&lt;User_DTO&gt;(0);
  
      String query = &quot;SELECT id, name, role FROM Usuario WHERE name LIKE ? AND role LIKE ? AND id != ? ORDER BY ? LIMIT ? OFFSET ?&quot;;
  
      String name = params.getName();
      String role = params.getRole();
      String id = params.getId();
  
      try
      {
          conn = Pool.getConnection();
          stmt = conn.prepareStatement(query);
      
          stmt.setString(1, &quot;%&quot; + name + &quot;%&quot;);
          stmt.setString(2, &quot;%&quot; + role + &quot;%&quot;);
          stmt.setString(3, id);
  
                  // Using setInt()
                  // stmt.setInt(4, order);
  
                  // Using setObject
          stmt.setObject(4, order, Types.INTEGER);
          System.out.println(order);
      
          if(limit == -1)
          {
              stmt.setNull(5, Types.NULL);
          }
          else
          {
              stmt.setInt(5, limit);
          }
      
          stmt.setInt(6, offset);
  
          //
          System.out.println(stmt);
      
          rs = stmt.executeQuery();
      
          while(rs.next())
          {
              result = new User_DTO();
          
              result.setId(rs.getString(&quot;id&quot;));
              result.setName(rs.getString(&quot;name&quot;));
              result.setRole(rs.getString(&quot;role&quot;));
          
              result_arr.add(result);
          }
      }
      catch(SQLException sql_e)
      {
          sql_e.printStackTrace();
      }
      finally
      {
          Pool.close(conn, stmt, rs);
      }
  
      return (result != null) ? result_arr.toArray(new User_DTO[result_arr.size()]) : null;
  }
  </code></pre>
  <p>The printed statement using <code>setInt()</code> is this:</p>
  <pre><code>SELECT id, name, role FROM Usuario WHERE name LIKE '%%' AND role LIKE '%%' AND id != '13253cc9' ORDER BY '[B@65adcbab' LIMIT '[B@75167bb3' OFFSET '[B@171360d3'
  </code></pre>
  <p>And the one printed using <code>setObject()</code>:</p>
  <pre><code>SELECT id, name, role FROM Usuario WHERE name LIKE '%%' AND role LIKE '%%' AND id != '13253cc9' ORDER BY '1' LIMIT '[B@75167bb3' OFFSET '[B@171360d3'
  </code></pre>
  <p>Any idea why this might be happening?</p>