I'm trying to get single row from Oracle DB by using RowMapper in Spring, but I'm getting the following exception:
Exception in thread "main java.lang.NoClassDefFoundError:
org/springframework/dao/DuplicateKeyException
Can anyone explain me the reason for that exception?
Below is my code:
public class EmployeeRowMapper implements RowMapper{
public Object mapRow(ResultSet rs,int rowNmu) throws SQLException {
Employee e = new Employee();
e.seteId(rs.getInt("ID"));
e.seteName(rs.getString("name"));
e.seteSal(rs.getFloat("sal"));
return e;
}
}
Here is how I try to retrie a row:
public Employee getEmpById(int id) {
String sql = "select * from emp where ENO = ?";
@SuppressWarnings("unchecked")
Employee e = (Employee)jt.queryForObject(sql,new Object[] {id}, new EmployeeRowMapper());
return e;
}