• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB 1.1 BMP Transaction question...rollback?

 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic