1. Error description
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:Result consisted of more than One Rowat 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:2713) at Com.mysql.jdbc.StatementImpl.executeUpdate (statementimpl.java:1794) at Com.mysql.jdbc.StatementImpl.executeUpdate (statementimpl.java:1712) at Org.apache.commons.dbcp.DelegatingStatement.executeUpdate (delegatingstatement.java:225)
2. Cause of error
Subqueries are used in queries when stitching SQL statements
Select T.name,t.age from t_student_info where t.id = (select d.stu_id from t_depart_info where t.depat_name = ' computer ');
When determining the ID, to ensure that the ID is unique, but this subquery can query out two results, which will result in an ID corresponding to multiple results, the above error occurs
3. Solutions
(1) If the query is not the only one, you can change "=" to "in"
(2) If it is the only one, and the subquery results are duplicated, you can use limit to restrict
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
caused By:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:Result consisted of more than