TransactionManagerinterface allows the application server to control transaction boundaries on behalf of the application being managed.
InitialContext ic = new InitialContext(); TransactionManager utm = ic.lookup("java:/TransactionManager")
nullor it refers to a specific global transaction. Multiple threads can be associated with the same global transaction. Nested transactions are not supported.
TransactionManagerbegins a new top-level transaction, and associates the transaction context with the calling thread. If the calling thread is already associated with a transaction then the
beginmethod throws the
getTransactionmethod returns the Transaction object that represents the transaction context currently associated with the calling thread. This object can be used to perform various operations on the target transaction. These operations are described elsewhere.
commitmethod completes the transaction currently associated with the calling thread. After it returns, the calling thread is not associated with any transaction. If
commitis called when the thread is not associated with any transaction context, an exception is thrown. In some implementations, only the transaction originator can use the
commitoperation. If the calling thread is not permitted to commit the transaction, an exception is thrown. JBossJTA does not impose any restrictions on the ability of threads to terminate transactions.
rollbackmethod is used to roll back the transaction associated with the current thread. After the
rollbackmethod completes, the thread is not associated with any transaction.