Announcement Announcement Module
Collapse
No announcement yet.
NamedParameterJdbcTemplate + an array of Integers + Sybase Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NamedParameterJdbcTemplate + an array of Integers + Sybase

    Found a bug and the stack pretty much looked like this:

    Code:
    com.sybase.jdbc2.jdbc.SybSQLException: Class [java.lang.Integer not found. Check and make sure that the class has been installed, and an entry exists in Sysxtypes
    Then I thought, aaaaw, I just have to convert 'em into primitives

    Code:
    int[] ids = ArrayUtils.toPrimitive(set.toArray(new Integer[set.size()]));
    And then plugged the ids into the query

    Code:
    return namedParameterJdbcTemplate.query("select distinct id from Coffee where id in ( :ids )", Collections.singletonMap("ids", ids),
                new ParameterizedRowMapper<Integer>(){
                public Integer mapRow(ResultSet rs, int rowNum) throws SQLException {
                    return rs.getInt("id");
                }
            });

    Ok. Then I got this;

    Code:
    com.sybase.jdbc2.jdbc.SybSQLException: Class [I not found. Check and make sure that the class has been installed, and an entry exists in Sysxtypes.
    I've never had any problems using either Integer nor int when I'm using the spring jdbc templates together with sybase. Any ideas?
Working...
X