|
Hi All, I've read through the user guide, past discussions in the group, and the MyBatis source, and I think I understand how I'd use a BatchExecutor to execute a batch and get back BatchResults for the executed statements, but I wanted to confirm that I'm on the right track. Does code like the following (ignoring error handling for the moment) look reasonable?
SqlSession session = ssFactory.openSession(ExecutorType.BATCH); GroupMapper mapper = session.getMapper(GroupMapper.class); for (Group group : groups) {
mapper.addGroup(group); } List<BatchResult> results = session.flushStatements(); session.commit(); session.close(); Matt
|
|
100% Matt. That is the right way to get the results.
On 11 abr, 22:24, Matt Passell <[hidden email]> wrote: > Hi All, > > I've read through the user guide, past discussions in the group, and the > MyBatis source, and I think I understand how I'd use a BatchExecutor to > execute a batch and get back BatchResults for the executed statements, but > I wanted to confirm that I'm on the right track. Does code like the > following (ignoring error handling for the moment) look reasonable? > > SqlSession session = ssFactory.openSession(ExecutorType.BATCH); > GroupMapper mapper = session.getMapper(GroupMapper.class); > > for (Group group : groups) { > mapper.addGroup(group); > } > > List<BatchResult> results = session.flushStatements(); > session.commit(); > session.close(); > > Thanks, > Matt |
|
I have test, the test report show that: Comparing with ibatis,
mybatis's batch insert operation cost double time. It is close to hibernate performance. |
|
Hi, Matt is referring to Spring-Batch, not to MyBatis-Batch.
This information is valued. Have you done a profiling? do you have any idea of where the time is lost? If you don't mind, please open a new thread to follow this conversation. |
|
Sorry, I am discussing in another thread, I attach the code and test
data, any advice is welcome. topic: Mybatis is very much slower than Ibatis or Jdbc url: http://groups.google.com/group/mybatis-user/browse_thread/thread/58ce58e1d708cac6 |
|
In reply to this post by Eduardo Macarron
El día 12 de abril de 2012 09:27, Eduardo Macarron
<[hidden email]> escribió: > Hi, Matt is referring to Spring-Batch, not to MyBatis-Batch. Sorry for the mess. It is Prashant who asked about Spring Batch, not Matt :) |
|
In reply to this post by Eduardo Macarron
Hi Eduardo,
Thanks! It appears to be working fine. :) Thanks, Matt On Thu, Apr 12, 2012 at 2:20 AM, Eduardo <[hidden email]> wrote: 100% Matt. That is the right way to get the results. |
|
In reply to this post by Eduardo Macarron
Thanks for clarifying that. I was about to send an email saying, "Hmm. I thought I was talking about MyBatis-Batch..." ;)
--Matt
On Thu, Apr 12, 2012 at 11:57 AM, Eduardo Macarron <[hidden email]> wrote: El día 12 de abril de 2012 09:27, Eduardo Macarron |
| Powered by Nabble | Edit this page |
