EJBTransaction:
Commit method
Description
Declares that the calling thread transaction should be committed.
Syntax
1 |
<span>ejbtrans</span>.Commit (<span></span><span> </span>) |
Argument |
Description |
---|---|
ejbtrans |
The name of an EJBTransaction object |
Return Values
None
Examples
In this example, the client calls the dopayroll method
on the CmpnyAcct EJB component, which processes a company payroll.
If the company has sufficient funds to meet the payroll, the client
commits the transaction. Otherwise, an exception is thrown and the
client rolls back the transaction:
1 |
// Instance variables:<br>// EJBTransaction trans<br>// EJBConnection conn<br>// CmpnyAcctHome AcctHome<br>// CmpnyAcct Acct<br> <br>TRY<br>   trans.begin()<br>   AcctHome = conn.lookup("CmpnyAcctHome",<br>      "Sample/CmpnyAcct", "sample.CmpnyAcctHome")<br>   Acct = AcctHome.create()<br>   Acct.dopayroll()<br>   trans.<span>commit()</span><br>CATCH (remoteexception re)<br>   messagebox("remoteexception", re.GetMessage())<br>CATCH (createexception ce)<br>   messagebox("createexception", ce.GetMessage())<br>CATCH (exception e1) <br>   MessageBox ("exception", e1.getmessage() )<br>   TRY <br>      trans.rollback();<br>     CATCH (exception e2)<br>      MessageBox ("exception", e2.getmessage() )<br>   END TRY<br>END TRY |
Usage
The Commit method completes the transaction
associated with the calling thread. The transaction is not completed
if any other participants in the transaction vote to roll back the
transaction.
See Also
-
-
Commit, GetStatus, GetEJBTransaction (EJBConnection
class), Rollback, SetRollbackOnly, SetTransactionTimeout
-
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments