I know this is a repeated question. Sorry for asking. I am having this error in my spring mvc application. This is my Impl file
public Map<String, String> employeelist() {
Map<String, String> map = new HashMap<String, String>();
List<Employee> lang1 = namedParameterJdbcTemplate.query("select * from
employee", new EmployeeMapper());
for (int i = 0; i < lang1.size(); i++) {
map.put(lang1.get(i).getLocalename(), lang1.get(i).getName());
}
return map;
}
public static final class EmployeeMapper implements RowMapper<Employee> {
public Employee mapRow(ResultSet rs, int rowNum) throws SQLException {
Map<String, String> map = new HashMap<String, String>();
Employee employee = new Employee();
employee.setId(rs.getString("id"));
employee.setName(rs.getString("name"));
employee.setSalary(rs.getString("salary"));
employee.setDesignation(rs.getString("designation"));
employee.setLocalename(rs.getString("localename"));
return employee;
}
}
While trying to execute this i am getting an error like "Caused by: java.sql.SQLException: Column 'localename' not found"
. All other fields are working correctly. But for localename only its showing the error. What is the problem here?? Please help me..
Sorry for my poor english
This is my employee class
package com.bct.internal.form.model;
public class Employee {
private String id;
private String name;
private String salary;
private String designation;
private String localename;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSalary() {
return salary;
}
public void setSalary(String salary) {
this.salary = salary;
}
public String getDesignation() {
return designation;
}
public void setDesignation(String designation) {
this.designation = designation;
}
public String getLocalename() {
return localename;
}
public void setLocalename(String localename) {
this.localename = localename;
}
@Override
public String toString() {
return "Employee [ID=" + id + ", NAME=" + name + ", SALARY=" + salary +
", LOCALE_NAME=" + localename + ", DESIGNATION=" + designation + "]";
}
}