org.springframework.jdbc.BadSqlGrammarE xception: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.Nested SQLException: --- The error occurred in ibatisextconf/test.xml. --- The error occurred while applying a result map. --- Check the Customer.CustomerResult. --- Check the result mapping for the 'id' property. --- Cause: java.sql.SQLException: Invalid column name id. at org.springframework.jdbc.support.SQLSta teSQLExceptionTranslator.doTranslate (SQLStateSQLExceptionTranslator.java:97 ) at org.springframework.jdbc.support.Abstra ctFallbackSQLExceptionTranslator.transl ate (AbstractFallbackSQLExceptionTranslator .java:72) at org.springframework.jdbc.support.Abstra ctFallbackSQLExceptionTranslator.transl ate (AbstractFallbackSQLExceptionTranslator .java:80) at org.springframework.jdbc.support.Abstra ctFallbackSQLExceptionTranslator.transl ate (AbstractFallbackSQLExceptionTranslator .java:80) at org.springframework.orm.ibatis.SqlMapCl ientTemplate.execute (SqlMapClientTemplate.java:212) at org.springframework.orm.ibatis.SqlMapCl ientTemplate.queryForObject (SqlMapClientTemplate.java:271) at com.webapp.maintain.customer.dao.Custom erDao.query(CustomerDao.java:50) at com.webapp.maintain.customer.service.Cu stomerService.query (CustomerService.java:23) at sun.reflect.NativeMethodAccessorImpl.in voke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.in voke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImp l.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.springframework.aop.support.AopUtil s.invokeJoinpointUsingReflection (AopUtils.java:307) at org.springframework.aop.framework.Refle ctiveMethodInvocation.invokeJoinpoint (ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.Refle ctiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interce ptor.TransactionInterceptor.invoke (TransactionInterceptor.java:106) at org.springframework.aop.framework.Refle ctiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:171) at org.springframework.aop.interceptor.Exp oseInvocationInterceptor.invoke (ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.Refle ctiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDy namicAopProxy.invoke (JdkDynamicAopProxy.java:204) at $Proxy25.query(Unknown Source) at com.webapp.maintain.customer.action.Cus tomerUpdateAction.query (CustomerUpdateAction.java:17) at com.webapp.struct.module.action.Action. doGet(Action.java:43) at com.webapp.struct.module.action.Empower mentAction.doGet (EmpowermentAction.java:27) at sun.reflect.NativeMethodAccessorImpl.in voke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.in voke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImp l.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.springframework.aop.support.AopUtil s.invokeJoinpointUsingReflection (AopUtils.java:307) at org.springframework.aop.framework.Refle ctiveMethodInvocation.invokeJoinpoint (ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.Refle ctiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:149) at org.springframework.aop.aspectj.MethodI nvocationProceedingJoinPoint.proceed (MethodInvocationProceedingJoinPoint.ja va:77) at com.webapp.struct.module.permissions.Pe rmissionsManager.checkQueryPermissions (PermissionsManager.java:71) at sun.reflect.NativeMethodAccessorImpl.in voke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.in voke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImp l.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.springframework.aop.aspectj.Abstrac tAspectJAdvice.invokeAdviceMethodWithGi venArgs(AbstractAspectJAdvice.java:627) at org.springframework.aop.aspectj.Abstrac tAspectJAdvice.invokeAdviceMethod (AbstractAspectJAdvice.java:616) at org.springframework.aop.aspectj.AspectJ AroundAdvice.invoke (AspectJAroundAdvice.java:64) at org.springframework.aop.framework.Refle ctiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:171) at org.springframework.aop.interceptor.Exp oseInvocationInterceptor.invoke (ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.Refle ctiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDy namicAopProxy.invoke (JdkDynamicAopProxy.java:204) at $Proxy3.doGet(Unknown Source) at com.webapp.main.WebApp.doGet (WebApp.java:108) at com.webapp.control.action.ActionProcess .execute(ActionProcess.java:24) at com.webapp.main.WebApp.service (WebApp.java:101) at javax.servlet.http.HttpServlet.service (HttpServlet.java:717) at org.apache.catalina.core.ApplicationFil terChain.internalDoFilter (ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFil terChain.doFilter (ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDis patcher.invoke (ApplicationDispatcher.java:630) at org.apache.catalina.core.ApplicationDis patcher.doInclude (ApplicationDispatcher.java:535) at org.apache.catalina.core.ApplicationDis patcher.include (ApplicationDispatcher.java:472) at org.apache.jasper.runtime.JspRuntimeLib rary.include (JspRuntimeLibrary.java:968) at org.apache.jsp.jsp.layout.systemmanage. content_jsp._jspService (content_jsp.java:140) at org.apache.jasper.runtime.HttpJspBase.s ervice(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service (HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWra pper.service (JspServletWrapper.java:374) at org.apache.jasper.servlet.JspServlet.se rviceJspFile(JspServlet.java:342) at org.apache.jasper.servlet.JspServlet.se rvice(JspServlet.java:267) at javax.servlet.http.HttpServlet.service (HttpServlet.java:717) at org.apache.catalina.core.ApplicationFil terChain.internalDoFilter (ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFil terChain.doFilter (ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDis patcher.invoke (ApplicationDispatcher.java:630) at org.apache.catalina.core.ApplicationDis patcher.processRequest (ApplicationDispatcher.java:436) at org.apache.catalina.core.ApplicationDis patcher.doForward (ApplicationDispatcher.java:374) at org.apache.catalina.core.ApplicationDis patcher.forward (ApplicationDispatcher.java:302) at com.webapp.struct.module.mapping.Mappin g.mapping(Mapping.java:25) at com.webapp.control.mapping.MappingProce ss.execute(MappingProcess.java:19) at com.webapp.main.WebApp.service (WebApp.java:101) at javax.servlet.http.HttpServlet.service (HttpServlet.java:717) at org.apache.catalina.core.ApplicationFil terChain.internalDoFilter (ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFil terChain.doFilter (ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrappe rValve.invoke (StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContex tValve.invoke (StandardContextValve.java:191) at org.apache.catalina.core.StandardHostVa lve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportV alve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngine Valve.invoke (StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAda pter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processo r.process(Http11Processor.java:845) at org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process (Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$ Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run (Thread.java:619) Caused by: com.ibatis.common.jdbc.exception.Nested SQLException: --- The error occurred in ibatisextconf/test.xml. --- The error occurred while applying a result map. --- Check the Customer.CustomerResult. --- Check the result mapping for the 'id' property. --- Cause: java.sql.SQLException: Invalid column name id. at com.ibatis.sqlmap.engine.mapping.statem ent.MappedStatement.executeQueryWithCal lback(MappedStatement.java:201) at com.ibatis.sqlmap.engine.mapping.statem ent.MappedStatement.executeQueryForObje ct(MappedStatement.java:120) at com.ibatis.sqlmap.engine.impl.SqlMapExe cutorDelegate.queryForObject (SqlMapExecutorDelegate.java:518) at com.ibatis.sqlmap.engine.impl.SqlMapExe cutorDelegate.queryForObject (SqlMapExecutorDelegate.java:493) at com.ibatis.sqlmap.engine.impl.SqlMapSes sionImpl.queryForObject (SqlMapSessionImpl.java:106) at org.springframework.orm.ibatis.SqlMapCl ientTemplate$1.doInSqlMapClient (SqlMapClientTemplate.java:273) at org.springframework.orm.ibatis.SqlMapCl ientTemplate.execute (SqlMapClientTemplate.java:209) ... 79 more Caused by: java.sql.SQLException: Invalid column name id. at net.sourceforge.jtds.jdbc.JtdsResultSet .findColumn(JtdsResultSet.java:976) at net.sourceforge.jtds.jdbc.JtdsResultSet .getInt(JtdsResultSet.java:980) at org.apache.commons.dbcp.DelegatingResul tSet.getInt (DelegatingResultSet.java:237) at sun.reflect.NativeMethodAccessorImpl.in voke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.in voke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImp l.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at com.ibatis.common.jdbc.logging.ResultSe tLogProxy.invoke (ResultSetLogProxy.java:47) at $Proxy76.getInt(Unknown Source) at com.ibatis.sqlmap.engine.type.IntegerTy peHandler.getResult (IntegerTypeHandler.java:35) at com.ibatis.sqlmap.engine.mapping.result .ResultMap.getPrimitiveResultMappingVal ue(ResultMap.java:619) at com.ibatis.sqlmap.engine.mapping.result .ResultMap.getResults (ResultMap.java:345) at com.ibatis.sqlmap.engine.execution.SqlE xecutor.handleResults (SqlExecutor.java:384) at com.ibatis.sqlmap.engine.execution.SqlE xecutor.handleMultipleResults (SqlExecutor.java:300) at com.ibatis.sqlmap.engine.execution.SqlE xecutor.executeQuery (SqlExecutor.java:189) at com.ibatis.sqlmap.engine.mapping.statem ent.MappedStatement.sqlExecuteQuery (MappedStatement.java:221) at com.ibatis.sqlmap.engine.mapping.statem ent.MappedStatement.executeQueryWithCal lback(MappedStatement.java:189) ... 85 more
修改内容在sql语句加id
<select id="customerQuery" parameterClass="string" resultMap="CustomerResult"> select id,name,password,age,sex from customer where id=#value# </select>