Hi mybatis users...
I was trying use mybatis with ejb on jboss 6.
when i call a RequiresNew session bean method it's not commited after the methods finish.
someone already had the same problem ? thank you
Example:
----------------
ResubmissionServiceFactory.getResubmissionService().updateResubmissionsRequiresNew(
ResubmissionTO.EXECUTING, ResubmissionBuilder.transform(invoicesToUpdateStatus), new Date());
-> here the data is not comited
----------------------------
/**
* @ejb.interface-method
* @ejb.transaction type="RequiresNew"
*/
@Override
public void updateResubmissionsRequiresNew(Integer state, Collection<ResubmissionTO> resubmissions,
Date processDate) {
ResubmissionDAO.getInstance().updateResubmissions(state, resubmissions, processDate);
}
ResubmissionDAO:
@Override
public void updateResubmissions(Integer state, Collection<ResubmissionTO> resubmissions, Date processDate) {
SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession(ExecutorType.BATCH);
try {
ResubmissionMapper mapper = sqlSession.getMapper(ResubmissionMapper.class);
for (ResubmissionTO resubmissionTO : resubmissions) {
mapper.updateStateErrorResubmission(resubmissionTO.getId(), state, resubmissionTO.getErrorMessage(),
processDate, resubmissionTO.getLotEventId());
}
sqlSession.flushStatements();
sqlSession.commit();
} finally {
sqlSession.close();
}
}