public void commit() throws HeuristicRollbackException, RollbackException, HeuristicMixedException, SystemException {
        Transaction transaction = currentTransaction();
        if (transaction == null) {
            throw new IllegalStateException("No active transaction");
        }
        transaction.commit();     
    }
public void commit ( ) throws HeuristicRollbackException , RollbackException , HeuristicMixedException , SystemException { Transaction transaction = currentTransaction ( ) ; if ( transaction == null ) { throw new IllegalStateException ( "No active transaction" ) ; } transaction . commit ( ) ; }
Commits the current transaction, if one exists.

@throws IllegalStateException If the calling thread is not associated with a transaction.
@throws SystemException If the transaction service fails in an unexpected way.
@throws HeuristicMixedException If a heuristic decision was made and some some parts of the transaction have been
committed while other parts have been rolled back.
@throws HeuristicRollbackException If a heuristic decision to roll back the transaction was made.