コード例 #1
0
 /**
  * Returns the current Transaction instance
  *
  * @return Transaction
  * @throws DatabaseException
  */
 public Transaction getTransaction() throws DatabaseException {
   if (transaction == null || !transaction.isValid()) {
     transaction = new JDBCTransaction(createConnection());
     if (transaction == null || !transaction.isValid()) {
       throw new DatabaseException("Connection Failed!");
     }
   }
   return transaction;
 }
コード例 #2
0
ファイル: TXConnection.java プロジェクト: kookse/bboss
 /** 重载父类方法,设置事务的状态标识为回滚状态 */
 public void rollback() throws SQLException {
   JDBCTransaction tx = TransactionManager.getTransaction();
   try {
     if (tx != null) tx.setRollbackOnly();
   } catch (IllegalStateException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (SystemException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }