This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin 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?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!