Client-managed transactions – PB Docs 125

Client-managed transactions

EJB client applications can control transactions on the server
using the EJBTransaction object. This object has methods that enable
the client to begin, commit, or roll back a transaction. The client
can also get the status of a transaction, change its timeout value,
or modify the transaction so that it cannot be committed.

The EJBTransaction methods map directly to the methods of
the javax.transaction.UserTransaction interface,
which is documented in the JTA Specification on the Sun Java Web site
.

Beginning and ending transactions

Clients can obtain access to the methods of the EJBTransaction
class by calling the getEJBTransaction method
of the EJBConnection class:

If an EJBTransaction instance is obtained successfully, you
use its begin method to start the transaction
and its commit or rollback methods
to end it:

Getting information about the transaction

GetStatus returns an integer that indicates
whether the transaction is active, has been marked for rollback,
is in the prepare phase or commit phase,
or has been committed or rolled back.

Setting a timeout period for transactions

A calling thread can specify a timeout period after which
a transaction will be rolled back. This example sets the timeout
period to 3 minutes (180 seconds):


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x