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 2020/12/11 09:28:59 UTC

[GitHub] [shardingsphere] guid-git opened a new issue #8577: sharding-sphere3.0.0+mybatisplus2.1.4+mysql, batchInsert error

guid-git opened a new issue #8577:
URL: https://github.com/apache/shardingsphere/issues/8577


   ## Question
   
   ### Error flushing statements.  Cause: java.lang.ArrayIndexOutOfBoundsException: 1
   ### Cause: java.lang.ArrayIndexOutOfBoundsException: 1
   	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.flushStatements(DefaultSqlSession.java:255)
   	at com.baomidou.mybatisplus.service.impl.ServiceImpl.insertBatch(ServiceImpl.java:131)
   	... 37 common frames omitted
   Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
   	at io.shardingsphere.shardingjdbc.executor.BatchPreparedStatementExecutor.accumulate(BatchPreparedStatementExecutor.java:176)
   	at io.shardingsphere.shardingjdbc.executor.BatchPreparedStatementExecutor.executeBatch(BatchPreparedStatementExecutor.java:168)
   	at io.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.executeBatch(ShardingPreparedStatement.java:236)


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] terrymanu edited a comment on issue #8577: sharding-sphere3.0.0+mybatisplus2.1.4+mysql, batchInsert error, help me !!!

Posted by GitBox <gi...@apache.org>.
terrymanu edited a comment on issue #8577:
URL: https://github.com/apache/shardingsphere/issues/8577#issuecomment-743704900


   I don't know what is mybatis-plus, could you get the actual SQL and jdbc method?


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] guid-git commented on issue #8577: sharding-sphere3.0.0+mybatisplus2.1.4+mysql, batchInsert error, help me !!!

Posted by GitBox <gi...@apache.org>.
guid-git commented on issue #8577:
URL: https://github.com/apache/shardingsphere/issues/8577#issuecomment-744193593


   for example, i call mybatis-plus's method ExampleService.insertBatch(list). when list's size is 10, sharding-sphere will put the same table data in one sql. such like '' insert into table values(),()"".   then look the method i said above "accumulate", each.getJdbcAndActualAddBatchCallTimesMap().entrySet() ’s size is 2。but when i debug the param "final List<int[]> results" of the method "accumulate" , i get the param int[] 'size is 1, so throw java.lang.ArrayIndexOutOfBoundsException:1


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] qixiaobo commented on issue #8577: sharding-sphere3.0.0+mybatisplus2.1.4+mysql, batchInsert error, help me !!!

Posted by GitBox <gi...@apache.org>.
qixiaobo commented on issue #8577:
URL: https://github.com/apache/shardingsphere/issues/8577#issuecomment-743705839


   > I don't know what is mybatis-plus, could you get the actual SQL and jdbc method?
   
   It's a framework based on mybatis https://github.com/baomidou/mybatis-plus (MyBatis-Plus is an powerful enhanced toolkit of MyBatis for simplify development. This toolkit provides some efficient, useful, out-of-the-box features for MyBatis, use it can effectively save your development time.).
   Maybe @guid-git should provide more info 


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] RaigorJiang commented on issue #8577: sharding-sphere3.0.0+mybatisplus2.1.4+mysql, batchInsert error, help me !!!

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #8577:
URL: https://github.com/apache/shardingsphere/issues/8577#issuecomment-748445797


   It is recommended that you first check whether the SQL is correct, so please provide your actual SQL, not the Java code.


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] guid-git commented on issue #8577: sharding-sphere3.0.0+mybatisplus2.1.4+mysql, batchInsert error, help me !!!

Posted by GitBox <gi...@apache.org>.
guid-git commented on issue #8577:
URL: https://github.com/apache/shardingsphere/issues/8577#issuecomment-743097077


   private int[] accumulate(final List<int[]> results) {
           int[] result = new int[batchCount];
           int count = 0;
           for (BatchRouteUnit each : routeUnits) {
               for (Entry<Integer, Integer> entry : each.getJdbcAndActualAddBatchCallTimesMap().entrySet()) {
                 ###   **int value = null == results.get(count) ? 0 : results.get(count)[entry.getValue()];**
                   if (DatabaseType.Oracle == getDatabaseType()) {
                       result[entry.getKey()] = value;
                   } else {
                       result[entry.getKey()] += value;
                   }
               }
               count++;
           }
           return result;
       }


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] terrymanu commented on issue #8577: sharding-sphere3.0.0+mybatisplus2.1.4+mysql, batchInsert error, help me !!!

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #8577:
URL: https://github.com/apache/shardingsphere/issues/8577#issuecomment-749898615


   Closed because of no response


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] terrymanu commented on issue #8577: sharding-sphere3.0.0+mybatisplus2.1.4+mysql, batchInsert error, help me !!!

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #8577:
URL: https://github.com/apache/shardingsphere/issues/8577#issuecomment-743704900


   I don't know what is mybatis-plus do, could you get the actual SQL and jdbc method?


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] terrymanu closed issue #8577: sharding-sphere3.0.0+mybatisplus2.1.4+mysql, batchInsert error, help me !!!

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


   


----------------------------------------------------------------
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.

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