当前位置: 代码迷 >> SQL >> 拼凑SQL语句缺少“break”
  详细解决方案

拼凑SQL语句缺少“break”

热度:260   发布时间:2016-05-05 10:11:27.0
拼接SQL语句缺少“break”

1、错误描述

[ERROR:]2015-07-20 16:42:21,734 [插入失败] org.hibernate.exception.SQLGrammarException: error executing work	at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:80)	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126)	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112)	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.coordinateWork(JdbcCoordinatorImpl.java:318)	at org.hibernate.internal.SessionImpl.doWork(SessionImpl.java:2059)	at org.hibernate.internal.SessionImpl.doReturningWork(SessionImpl.java:2055)	base.dao.impl.BaseDaoImpl.executeQuery(BaseDaoImpl.java:137)	query.dao.impl.QueryDaoImpl.query(QueryDaoImpl.java:700)	query.service.impl.QueryServiceImpl.query(QueryServiceImpl.java:29)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:606)	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)	at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)	at com.sun.proxy.$Proxy31.query(Unknown Source)	query.controller.QueryController.query(QueryController.java:31)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:606)	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)	at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	filter.TranscationFilter.doFilter(TranscationFilter.java:32)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	filter.ContentFilter.doFilter(ContentFilter.java:69)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)	at java.lang.Thread.run(Thread.java:745)Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a.time,' at line 1	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)	at com.mysql.jdbc.Util.getInstance(Util.java:386)	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719)	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2318)	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)	base.dao.impl.BaseDaoImpl$2.execute(BaseDaoImpl.java:147)	base.dao.impl.BaseDaoImpl$2.execute(BaseDaoImpl.java:1)	at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:72)	at org.hibernate.internal.SessionImpl$3.accept(SessionImpl.java:2052)	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.coordinateWork(JdbcCoordinatorImpl.java:313)	... 82 more[ERROR:]2015-07-20 16:42:21,758 [异常拦截] com.skycloud.oa.exception.ExceptionHandler code is 9998;desc is 查询失败exception is org.hibernate.exception.SQLGrammarException: error executing work	query.service.impl.QueryServiceImpl.query(QueryServiceImpl.java:34)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:606)	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)	at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)	at com.sun.proxy.$Proxy31.query(Unknown Source)	query.controller.QueryController.query(QueryController.java:31)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:606)	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)	at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	filter.TranscationFilter.doFilter(TranscationFilter.java:32)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	filter.ContentFilter.doFilter(ContentFilter.java:69)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)	at java.lang.Thread.run(Thread.java:745)org.springframework.web.util.NestedServletException: Request processing failed; nested exception is  code is 9998;desc is 查询失败exception is org.hibernate.exception.SQLGrammarException: error executing work	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973)	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)	at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	filter.TranscationFilter.doFilter(TranscationFilter.java:32)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	filter.ContentFilter.doFilter(ContentFilter.java:69)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)	at java.lang.Thread.run(Thread.java:745)Caused by:  code is 9998;desc is 查询失败exception is org.hibernate.exception.SQLGrammarException: error executing work	query.service.impl.QueryServiceImpl.query(QueryServiceImpl.java:34)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:606)	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)	at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)	at com.sun.proxy.$Proxy31.query(Unknown Source)	query.controller.QueryController.query(QueryController.java:31)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:606)	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)	... 50 more

2、错误原因

     由于在查询时用到switch...case语句

switch(user.getId()){     case 1:            sql.append("");            params.add(user.getCode());            break;     case 2:            sql.append("");     case 3:           sql.append("")           break;}

    在第二个case结束时,未添加break,导致报错


3、解决办法

     在第二个case后添加break

switch(user.getId()){     case 1:            sql.append("");            params.add(user.getCode());            break;     case 2:            sql.append("");            break;     case 3:           sql.append("")           break;}


版权声明:本文为博主原创文章,未经博主允许不得转载。

  相关解决方案