public Transaction transaction() {
        if (transationHandler.get() != null) {
            if (ALLOW_NESTED_TRANSACTION) {
                return new JdbcNestedTransaction(transationHandler.get().getConnection());
            }
            throw new TransactionException("Can't begin a nested transaction.");
        }
        try {
            JdbcTransaction tx = new JdbcTransaction(dataSource.getConnection(), transationHandler);
            transationHandler.set(tx);
            return tx;
        } catch (SQLException e) {
            throw new TransactionException(e);
        }
    }
public Transaction transaction ( ) { if ( transationHandler . get ( ) != null ) { if ( ALLOW_NESTED_TRANSACTION ) { return new JdbcNestedTransaction ( transationHandler . get ( ) . getConnection ( ) ) ; } throw new TransactionException ( "Can't begin a nested transaction." ) ; } try { JdbcTransaction tx = new JdbcTransaction ( dataSource . getConnection ( ) , transationHandler ) ; transationHandler . set ( tx ) ; return tx ; } catch ( SQLException e ) { throw new TransactionException ( e ) ; } }
启动一个事务(默认支持子事务)