Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB 1.1 BMP Transaction question...rollback?  RSS feed

 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All-
I have a question re: transactional behavior and BMP SQL Errors: (using WAS 4 BTW)
In a DAO component, after a table update, I write the record to an audit table, and if an exception occurs on the audit, the dao swallows it so as not to impact the update of the main table :
catch(Exception se)
{
//swallow this exception so audit doesn't impact the application
String msg =PREFIX+" Exception while inserting "+AUDIT_TABLE+" "+se;
logger.error(mPre+msg);
}
the EJB�s descriptor is set to ALL methods SUPPORTS:
<container-transaction>
<method>
<ejb-name>DataGroupElementFormat</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
My question is:
Will a swallowed SQL exception cause a transaction rollback even though I am attempting to swallow it?
Thanks!
Max Tomlinson
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should not.
For the entity bean that invokes the method on the DAO within the transaction context, no exception will be visible because you are catching it. This means the transaction succeeds and the record should be persisted in the table.
Are you observing anything different?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!