I have created a method in DAO:
public String getUserName(int userid){
String sql="SELECT userName from UserDetail where userid=?";
return jdbcTemplate.queryForObject(sql, new Object[]{userid}, String.class);
}
this line: jdbcTemplate.queryForObject(sql, new Object[]{userid}, String.class)
is giving the following errors:
The method queryForObject(String, Object[], Class<String>) from the type JdbcTemplate refers to the missing type DataAccessException
Multiple markers at this line
- The type org.springframework.dao.DataAccessException cannot be resolved. It is indirectly referenced from required .class files
- The method queryForObject(String, Object[], Class<String>) from the type JdbcTemplate refers to the missing type
DataAccessException
I am using spring-jdbc 4.0.0 with mysql-connector 5.1.25, commons-dbcp-1.4 and commons-pool-1.6. Could you please tell me what am I mssing.