Hello:
  My transactionManager type is JDBC. There is a sample in IBatis3 document:

SqlSession session = sqlSessionFactory.openSession();
try {
    // following 3 lines pseudocod for “doing some work”
    session.insert(...);
    session.update(...);
    session.delete(...);
    session.commit();
} finally {
    session.close();
}

  If  an insert statement failed caused by duplicated key,can I catch
SQLException and call session.rollback()?Like so:
SqlSession session = sqlSessionFactory.openSession();
try {
    // following 3 lines pseudocod for “doing some work”
    session.insert(...);
    session.update(...);
    session.delete(...);
    session.commit();
}catch(SQLException ex){
    session.rollback();
} finally {
    session.close();
}
  I don't want to use any frameworks.


陈抒
Best regards
http://blog.csdn.net/sheismylife

Reply via email to