Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
JdbcTemplate.queryForObject(sql, <primitive>.class) produces TypeMismatchDataAccessException [SPR-13220] #17811
The following code
int i = jdbcTemplate.queryForObject(sql,int.class);
Instead, Spring should convert the Integer to an int.
Migrating from Spring 4.1 to 4.2
This bug is much more apparent now that Spring 4.2 removed methods like
int i = jdbcTemplate.queryForInt(sql);
int i = jdbcTemplate.queryForObject(sql, int.class);
which would produce the above
int i = jdbcTemplate.queryForObject(sql, Integer.class);
to workaround the issue.
Affects: 4.2 RC2
Juergen Hoeller commented
Fixed through a