Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two transactions in one CMP MDB

 
Rick Dias
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a CMP MDB, triggered by websphere scheduler and do some process. There is a requirement that I need to write a record in the error logging table when exception thrown from the process. But if there is exception, my transaction is rollback and so as the record in the error logging table. Is there any way I can begin another transaction in CMP?

I'm using websphere 6.1 and oracle 10g.

Thanks in advance.

Rick
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"rickdias rickdias",
Welcome to JavaRanch!

We're pleased to have you here with us here on the ranch, but there are a few rules that need to be followed. One is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Initials are OK for the first and middle names but not the last. You can change it here
[ April 25, 2008: Message edited by: Ben Souther ]
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the NotSupported transaction attribute for the method which is doing the logging. This will ensure that the method will never take part in a transaction. If the logging method fails, then the calling process will not be affected because its transaction will have been suspended prior to calling the logging method.
 
Pedro Erencia
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As i understand the post, i would say "No, there's no way to start a new transaction in CMP", and suggest something like this..



By your post Roger it seems that you understood that first goes the logging, then the processing... maybe i've misunderstood it, Rick ?
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The doLog() method would be a public method of a CMT stateless session bean. It will have the NotSupported transaction attribute. When an exception is caught in the MDB, the doLog() method is invoked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic