spring mvc - BadSqlGrammarException:Caused by: java.sql.SQLException: Invalid column name -


hi getting above exception when running code.

here class.

    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 + ", ]";     }  } 

and impl file is

@override     public map<string, string> practicelist() {         map<string, string> map = new hashmap<string, string>();         list<dept> lang1 = namedparameterjdbctemplate.query("select * dept", new deptmapper());         (int = 0; < 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;         }      } 

when trying execute code getting error "error globalexceptionhandler.defaulterrorhandler -1 - [url] : http://localhost:8082/internalhost/usersearch/107 org.springframework.jdbc.badsqlgrammarexception: preparedstatementcallback; bad sql grammar [select * dept]; nested exception java.sql.sqlexception: invalid column name"

here database table image

error says invalid column name. can validate database table columns matching rowmapper resultset getters.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -