File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Two transactions in one CMP MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Two transactions in one CMP MDB" Watch "Two transactions in one CMP MDB" New topic
Author

Two transactions in one CMP MDB

Rick Dias
Greenhorn

Joined: Apr 25, 2008
Posts: 1
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

Joined: Dec 11, 2004
Posts: 13410

"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 ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
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.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Pedro Erencia
Ranch Hand

Joined: Apr 03, 2008
Posts: 70
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

Joined: Sep 29, 2002
Posts: 1683
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Two transactions in one CMP MDB
 
Similar Threads
MDB does not rollback
How to stop MDB retry invocation during System Exception
MDB does not rollback
Handle transaction using MDB
Transaction Rollback problem