I want to make sure I'm understanding how to use iBatis batching correctly.
I understand now that SqlMapDaoTemplate, contains the method,
startBatch() and execute batch. My Dao will extend SqlMapBaseDao
which extends SqlMapDaoTemplate.
So, since my Dao's are sharing the same daoManager, if I startBatch()
on each dao, do some work, and then executeBatch() on each dao, the
set of Dao's will be considered to be apart of the same batch?
Example:
try {
daoManager.startTransaction();
SqlMapSchoolDao schoolDao = new SqlMapSchoolDao(daoManager);
SqlMapMajorDao majorDao = new SqlMapMajorDao(daoManager);
SqlMapCourseDao courseDao = new SqlMapCourseDao(daoManager);
schoolDao.startBatch();
majorDao.startBatch();
courseDao.startBatch();
// Do some iterative tasks.
schoolDao.executeBatch();
majorDao.executeBatch();
courseDao.executeBatch();
} catch (Exception e) {
throw new ServiceException(e.getMessage());
} finally {
daoManager.endTransaction();
}