This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes CMT in JAVAEE5.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "CMT in JAVAEE5.0 " Watch "CMT in JAVAEE5.0 " New topic
Author

CMT in JAVAEE5.0

walter wang
Ranch Hand

Joined: Jun 02, 2001
Posts: 154
Dear all,

I encounter a roll back problem for my transactions in my stateless session ( implemented under EJB3.0 standard ).

According to below quoted sentence from JAVAEE5.0 Tutorial.

If I didnot explicitly mark transaction for my stateless session's methods
then all those methods are automatically Contain transactin managed , is it correct?
but it seems .the method doesnot roll back successfully when a exception happened inside it. I used JBoss4.0 + Stateless SessinBean (no explicit transacation demarcation used ).

Any hints? Is it a transacatin problem from JBoss or my misunderstanding to
CMT for Stateless Session Bean?

Thanks in advances



Container-Managed Transactions

In an enterprise bean with container-managed transaction demarcation, the EJB container sets the boundaries of the transactions. You can use container-managed transactions with any type of enterprise bean: session, or message-driven. Container-managed transactions simplify development because the enterprise bean code does not explicitly mark the transaction's boundaries. The code does not include statements that begin and end the transaction.

By default if no transaction demarcation is specified enterprise beans use container-managed transaction demarcation.


public class Walter { public boolean is_Working_Now (boolean is_boss_Coming) { return is_boss_Coming; }
walter wang
Ranch Hand

Joined: Jun 02, 2001
Posts: 154
I found the reason
cos I should only throw SystemException, then CMT can roll back correctly
SystemException is the sub class Exception of EJBException
 
Consider Paul's rocket mass heater.
 
subject: CMT in JAVAEE5.0