-
1. Re: how to get Container Managed Transactions in session bea
perseus Feb 9, 2004 12:54 PM (in response to gort)Hi gort,
I have the same problem, like some other guys too.
I found a brand new 70 euros problem ticket at www.infutura.com dealing with exactly the same question.
I think we have to wait until it is solved there.
Solutions are free. To view solution proposals you have to be a member. But membership is free.
Regards
Jack -
2. Re: how to get Container Managed Transactions in session bea
zhaotq Feb 10, 2004 12:32 AM (in response to gort)setRollbackOnly before throw your exception.
-
3. Re: how to get Container Managed Transactions in session bea
gort Feb 10, 2004 1:03 PM (in response to gort)thanks, but i don't need to set setRollbackOnly, it rolls back correctly when i use bean-managed (my own) transactions as shown commented out.
i'm trying to avoid writing tx.commit() and tx.rollback() and tx.setRollbackOnly() in the first place. by setting my session bean to container-managed transactions. -
4. Re: how to get Container Managed Transactions in session bea
pilhuhn Feb 10, 2004 2:39 PM (in response to gort)What do you want to achieve?
If you want a CMT to be rolled back you also need to tell it so.
If an exception occours, fine. If your business logic decides to roll back - how should the container know this? -
5. Re: how to get Container Managed Transactions in session bea
gort Feb 11, 2004 9:12 AM (in response to gort)i thought the point of a container-managed transaction is that iether the entire thing commits, or the entire thing fails. Like that whole ATM example, getting $ and subtracting it from the account is one transaction. if error happens the whole thing does not happen -- it doesn't subtract money from your account without giving it to you -- it rolls back.
bascially what you're saying is that there is no such thing as a container managed transaction, even when ejb-jar.xml has a <trans-attribute>Required</trans-attribute>, i still need to manage transactions myself -- telling them when to start, commit, and roll back? -
6. Re: how to get Container Managed Transactions in session bea
gort Feb 11, 2004 9:45 AM (in response to gort)I tried to get a usertransaction in a contaniner-managed bean and Jboss told me "CMT beans are not allowed to get a UserTransaction"
so i using setRollBackOnly() or even rollBack() is not the solution to the container-managed transactions problem, because Jboss will not even let me access it in Container Managed Transactions.
my question is not about using UserTransaction (UserTransaction works in Bean-managed session beans but not, as shown, CMT) but about getting a container-managed transaction to roll back when it fails! -
7. Re: how to get Container Managed Transactions in session bea
gort Feb 11, 2004 10:20 AM (in response to gort)ok i get it...
i need to set setRollbackOnly () on the *SessionContext* when i catch exception.
i didn't see that method there...
it works now