본문 바로가기

Framework/__Spring

How to do Spring Transaction using Ibatis

  try {
   getSqlMapClientTemplate().getSqlMapClient().startTransaction();
   getSqlMapClientTemplate().getSqlMapClient().getCurrentConnection().setAutoCommit( false );
   getSqlMapClientTemplate().getSqlMapClient().commitTransaction();
   getSqlMapClientTemplate().update("modify1", param);
   getSqlMapClientTemplate().update("modify2", param);    
   getSqlMapClientTemplate().getSqlMapClient().getCurrentConnection().commit();
   getSqlMapClientTemplate().getSqlMapClient().endTransaction();
  } catch ( Exception e ) {
   e.printStackTrace();
   throw new RuntimeException();
  }