こんにちは、私は私のコードを実行する際に上記の例外が発生しています。BadSqlGrammarException:原因:java.sql.SQLException:無効な列名
ここは私のクラスです。
package com.bct.internal.form.model;
public class Dept {
public String deptno;
public String deptname;
public String location;
public String getDeptno() {
return deptno;
}
public void setDeptno(String deptno) {
this.deptno = deptno;
}
public String getDeptname() {
return deptname;
}
public void setDeptname(String deptname) {
this.deptname = deptname;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
@Override
public String toString() {
return "Dept [DEPTNO=" + deptno + ", DNAME=" + deptname + ", LOC=" + location + ", ]";
}
}
と私のimplファイルが
@Override
public Map<String, String> practicelist() {
Map<String, String> map = new HashMap<String, String>();
List<Dept> lang1 = namedParameterJdbcTemplate.query("select * from dept", new DeptMapper());
for (int i = 0; i < lang1.size(); i++) {
map.put(lang1.get(i).getDeptno(), lang1.get(i).getDeptname());
}
return map;
}
public static final class DeptMapper implements RowMapper<Dept> {
@Override
public Dept mapRow(ResultSet rs, int rowNum) throws SQLException {
Map<String, String> map = new HashMap<String, String>();
Dept dept = new Dept();
dept.setDeptname(rs.getString("deptname"));
dept.setDeptno(rs.getString("deptno"));
dept.setLocation(rs.getString("location"));
return dept;
}
}
私は「ERROR GlobalExceptionHandler.defaultErrorHandler -1のようなエラーコードを取得しています実行しようとしている - [URL]:http://localhost:8082/internalhost/userSearch/107 org.springframework.jdbcを.BadSqlGrammarException:PreparedStatementCallback;不正なSQL文法[select * from dept];ネストされた例外はjava.sql.SQLExceptionです:無効な列名 "
ここに私のデータベーステーブル image
「deptname、deptno、deptからの位置」を試してください –
@ElliottFrisch返信いただきありがとうございます:)私はそれを試しました..同じエラーをまだ示しています。 – Shanmugapriya