Hey, thanks for question. I'm looking for the same.

Originally Posted by
seetasomagani
You'll need to open a new session with the new executor type.
SqlSession sqlSession = getSqlSessionFactory().openSession(ExecutorType.BA TCH);
AdminMapper adminMapper = sqlSession.getMapper(AdminMapper.class);
for(APXIGBean apxig : apxigList) {
adminMapper.insertAPXIG(Integer.parseInt(apxig.get Id()));
}
sqlSession.flushStatements();
sqlSession.commit();
sqlSession.close();
That's correct. But how to do this via Spring and do not create batched map manually.
Now I have
HTML Code:
<bean id="MyDefaultDao" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.foo.MyInterface"/>
<property name="sqlSessionFactory" ref="mySqlSessionFactory"/>
</bean>
And I want smth like this:
HTML Code:
<bean id="MyBatchDao" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.foo.MyInterface"/>
<property name="execType" value="ExecutorType.BATCH"/>
<property name="sqlSessionFactory" ref="mySqlSessionFactory"/>
</bean>
And inject this to required object