  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | | | Transactions | Transactions 2004-05-25 - By Jaise George
Back The following is an excerpt from the URL <http://info.borland.com/techpubs/jbuilder/jbuilder8/enterprise/transact ions.html> http://info.borland.com/techpubs/jbuilder/jbuilder8/enterprise/transacti ons.html
Local and global transactions
When a single connection to a database exists, the enterprise bean can directly control the transaction by calling commit() or rollback() on the connection. This type of transaction is a local transaction. Using global transactions, all database connections are registered with the global transaction service, which handles the transaction. For a global transaction, the enterprise bean never makes calls directly on a database connection itself.
A bean that uses bean-managed transaction demarcation uses the javax.transaction.UserTransaction interface to identify the boundaries of a global transaction. When a bean uses container-managed demarcation, the container interrupts each client call to control the transaction demarcation, using the transaction attribute set in the bean's deployment descriptor by the application assembler. The transaction attribute also determines whether the transaction is local or global.
For container-managed transactions, the container follows certain rules to determine when it should do a local versus a global transaction. Usually a container calls the method within a local transaction after verifying that no global transaction already exists. It also verifies that it isn't expected to start a new global transaction and that the transaction attributes are set for container-managed transactions. The container automatically wraps a method call within a local transaction if one of the follow conditions is true:
The transaction attribute is set to NotSupported and the container detects that the database resources were accessed.
The transaction attribute is set to Supports and the container detects that the method wasn't invoked from within a global transaction.
The transaction attribute is set to Never and the container detects that database resources are accessed.
Best Regards
Jaise
-- --Original Message-- -- From: A mailing list for Java(tm) 2 Platform, Enterprise Edition [mailto:J2EE-INTEREST@(protected)] On Behalf Of Ashutosh Bhardwaj Sent: Tuesday, May 25, 2004 1:22 PM To: J2EE-INTEREST@(protected) Subject: Transactions
Can somebody throw some lighty on local and global transactions ? what are shareable and unsahreable connections?
regards, ashutosh ======================================================================== === To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"> <TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD> <BODY> <DIV><FONT size=2> <P>The following is an excerpt from the URL </FONT><A href="http://info.borland.com/techpubs/jbuilder/jbuilder8/enterprise /transactions.html"><U><FONT color=#0000ff size=2>http://info.borland.com/techpubs/jbuilder/jbuilder8/enterprise /transactions.html</U></FONT></A></P> <P><FONT size=2>Local and global transactions</FONT></P> <P><FONT size=2>When a single connection to a database exists, the enterprise bean can directly control the transaction by calling commit() or rollback() on the connection. This type of transaction is a local transaction. Using global transactions, all database connections are registered with the global transaction service, which handles the transaction. For a global transaction, the enterprise bean never makes calls directly on a database connection itself. </FONT></P> <P><FONT size=2>A bean that uses bean-managed transaction demarcation uses the javax.transaction.UserTransaction interface to identify the boundaries of a global transaction. When a bean uses container-managed demarcation, the container interrupts each client call to control the transaction demarcation, using the transaction attribute set in the bean's deployment descriptor by the application assembler. The transaction attribute also determines whether the transaction is local or global.</FONT></P> <P><FONT size=2>For container-managed transactions, the container follows certain rules to determine when it should do a local versus a global transaction. Usually a container calls the method within a local transaction after verifying that no global transaction already exists. It also verifies that it isn't expected to start a new global transaction and that the transaction attributes are set for container-managed transactions. The container automatically wraps a method call within a local transaction if one of the follow conditions is true:</FONT></P> <P><FONT size=2>The transaction attribute is set to NotSupported and the container detects that the database resources were accessed.</FONT></P> <P><FONT size=2>The transaction attribute is set to Supports and the container detects that the method wasn't invoked from within a global transaction.</FONT></P> <P><FONT size=2>The transaction attribute is set to Never and the container detects that database resources are accessed. </FONT></P> <P><SPAN class=683455808-25052004><FONT face=Verdana color=#000080 size=2></FONT></SPAN> </P> <P><FONT face=Verdana color=#000080 size=2><SPAN class=683455808-25052004>Best Regards</SPAN></FONT></P> <P><FONT face=Verdana color=#000080 size=2><SPAN class=683455808-25052004>Jaise</SPAN></FONT></P></DIV> <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> <DIV></DIV> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT face=Tahoma size=2>-- --Original Message-- --<BR><B>From:</B> A mailing list for Java(tm) 2 Platform, Enterprise Edition [mailto:J2EE-INTEREST@(protected)] <B>On Behalf Of </B>Ashutosh Bhardwaj<BR><B>Sent:</B> Tuesday, May 25, 2004 1:22 PM<BR><B>To:</B> J2EE-INTEREST@(protected)<BR><B>Subject:</B> Transactions<BR><BR></FONT></DIV> <DIV><SPAN class=390085007-25052004><FONT face=Arial size=2>Can somebody throw some lighty on local and global transactions ? what are shareable and unsahreable connections?</FONT></SPAN></DIV> <DIV><SPAN class=390085007-25052004><FONT face=Arial size=2></FONT></SPAN> </DIV> <DIV><SPAN class=390085007-25052004><FONT face=Arial size=2>regards,</FONT></SPAN></DIV> <DIV><SPAN class=390085007-25052004><FONT face=Arial size=2>ashutosh</FONT></SPAN></DIV>========================================== ================================= To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help". <P></P></BLOCKQUOTE></BODY></HTML> =========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help". <p>
|
|
 |