You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/08/16 04:15:33 UTC

[GitHub] [shardingsphere] zjcnb opened a new issue #11839: sharding-spring-boot-mybatis-example run failed

zjcnb opened a new issue #11839:
URL: https://github.com/apache/shardingsphere/issues/11839


   ### Which version of ShardingSphere did you use?
   
   master
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   sharding-spring-boot-mybatis-example run success
   
   ### Actual behavior
   sharding-spring-boot-mybatis-example run failed
   
   Exception:
   
   ```
   Exception in thread "main" org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
   ### Error updating database.  Cause: org.apache.shardingsphere.infra.exception.ShardingSphereException: Insert statement does not support sharding table routing to multiple data nodes.
   ### The error may exist in META-INF/mappers/OrderMapper.xml
   ### The error may involve defaultParameterMap
   ### The error occurred while setting parameters
   ### SQL: INSERT INTO t_order (user_id, address_id, status) VALUES (?, ?, ?);
   ### Cause: org.apache.shardingsphere.infra.exception.ShardingSphereException: Insert statement does not support sharding table routing to multiple data nodes.
   	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
   	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
   	at com.sun.proxy.$Proxy159.insert(Unknown Source)
   	at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
   	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
   	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
   	at com.sun.proxy.$Proxy160.insert(Unknown Source)
   	at org.apache.shardingsphere.example.core.mybatis.service.OrderServiceImpl.insertData(OrderServiceImpl.java:103)
   	at org.apache.shardingsphere.example.core.mybatis.service.OrderServiceImpl.processSuccess(OrderServiceImpl.java:79)
   	at org.apache.shardingsphere.example.core.mybatis.service.OrderServiceImpl$$FastClassBySpringCGLIB$$bc37129f.invoke(<generated>)
   	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
   	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
   	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
   	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
   	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
   	at org.apache.shardingsphere.example.core.mybatis.service.OrderServiceImpl$$EnhancerBySpringCGLIB$$3befdc9a.processSuccess(<generated>)
   	at org.apache.shardingsphere.example.core.api.ExampleExecuteTemplate.run(ExampleExecuteTemplate.java:29)
   	at org.apache.shardingsphere.example.sharding.spring.boot.mybatis.ShardingSpringBootMybatisExample.main(ShardingSpringBootMybatisExample.java:38)
   Caused by: org.apache.ibatis.exceptions.PersistenceException: 
   ### Error updating database.  Cause: org.apache.shardingsphere.infra.exception.ShardingSphereException: Insert statement does not support sharding table routing to multiple data nodes.
   ### The error may exist in META-INF/mappers/OrderMapper.xml
   ### The error may involve defaultParameterMap
   ### The error occurred while setting parameters
   ### SQL: INSERT INTO t_order (user_id, address_id, status) VALUES (?, ?, ?);
   ### Cause: org.apache.shardingsphere.infra.exception.ShardingSphereException: Insert statement does not support sharding table routing to multiple data nodes.
   	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
   	... 18 more
   Caused by: org.apache.shardingsphere.infra.exception.ShardingSphereException: Insert statement does not support sharding table routing to multiple data nodes.
   	at org.apache.shardingsphere.sharding.route.engine.validator.dml.impl.ShardingInsertStatementValidator.postValidate(ShardingInsertStatementValidator.java:108)
   	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.lambda$createRouteContext$1(ShardingSQLRouter.java:62)
   	at java.util.Optional.ifPresent(Optional.java:159)
   	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:62)
   	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:47)
   	at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:62)
   	at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:52)
   	at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.route(KernelProcessor.java:54)
   	at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:46)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createExecutionContext(ShardingSpherePreparedStatement.java:361)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:269)
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
   	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
   	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
   	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
   	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
   	... 24 more
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero closed issue #11839: sharding-spring-boot-mybatis-example run failed

Posted by GitBox <gi...@apache.org>.
tristaZero closed issue #11839:
URL: https://github.com/apache/shardingsphere/issues/11839


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org