Hi:
WAS 4.0 has a vendor-specific property one can set for CMT entity and
session beans: Local Transaction -- Unresolved Action. This property is used
in the case where a method is running with an unspecified transaction
context. "Unresolved Action" can have the values Rollback or Commit. If a
local transaction is running and the application doesn't commit or rollback,
the container automatically ends the transaction according to the value of
"Unresolved Action". So if "Unresolved Action" is commit, and I have the
following code in a CMT entity bean method with transaction attribute "Not
Supported", the container will automatically commit the transaction:
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/ATMDataSource");
Connection conn = ds.getConnection();
conn.setAutoCommit( false );
Statement stmt = conn.createStatement();
String query = "select balance from accountentity where
accountnumber = '1111111' ";
ResultSet rs = stmt.executeQuery( query );
rs.next();
double balance = rs.getInt( 1 );
rs.close();
balance = balance + amount;
String update = "update accountentity set balance = " +
balance + " where accountnumber = '1111111' ";
int retVal = stmt.executeUpdate( update );
stmt.close();
conn.close();
(Note: The container does not provide this automatic support if the
connection is obtained via the DriverManager.)
1. Does anyone know of a practical reason why an app would need to use a
local transaction in this way? IBM Support says this feature is for the case
where the application needs to catch the exceptions associated with commit()
or rollback() and deal with them. Does anyone have any real examples of such
a requirement?
2. It seems as a rule of thumb "Unresolved Action" should be set to
"Rollback", as the application should always end transactions and if it
doesn't, we want to find out ASAP when testing.
Any comments on this feature? Do any other app servers have this feature?
Laurel
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".