jdbc加入批量插入转换参数rewriteBatchedStatements=true
取消修改基础service中没必要调用的代码
This commit is contained in:
@@ -109,7 +109,8 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
T t = data.get(index);
|
||||
((CrudDao<T>) batchSqlSession.getMapper(mClass)).insert(t);
|
||||
//insertForBatch不要带上ID,会影响效率
|
||||
((CrudDao<T>) batchSqlSession.getMapper(mClass)).insertForBatch(t);
|
||||
// if(index>0&&index%batchSize==0) {
|
||||
// batchSqlSession.commit();
|
||||
// batchSqlSession.clearCache();
|
||||
|
||||
Reference in New Issue
Block a user