-
1. Re: JBoss 7 Without XA Data Sources
wdfink Sep 7, 2012 2:39 AM (in response to randy.layman)Mmmmh,
I'm not sure at the moment what the spec recommend....
But I suppose it is a fuzzy transaction handling and each container might handle it different.
I would design it in a way that the credidcard part is a separate transaction (new Bean @Transaction.RequiresNew).
In this case it is clean that and when the Tx is commited. In your case the CreditCard Tx is commited at the end of your use case, so if you have an Exception after the CC is charged this Tx is also rolled back.
The only difference is the small timeslice where your code is finised and both Tx should commited.
So I would think that the behavior of AS7 is better and avoid Tx trouble and fuzzy behavior, but it might be a matter of opinion
-
2. Re: JBoss 7 Without XA Data Sources
randy.layman Sep 7, 2012 7:14 AM (in response to wdfink)I'll look deeper at applying that suggestion to our code. I'm not sure how straight forward that would be (there is some intermingling of transactions as we first authorize, then perform the actions that don't cost us money, then charge, then perform the actions that cost us money).
Is there not a way to bring back the JBoss 4 behavior of having the transaction manager handle each transaction possible?
-
3. Re: JBoss 7 Without XA Data Sources
wdfink Sep 7, 2012 8:41 AM (in response to randy.layman)No because if you use container managed transaction the contract with the Spec is
- success or BusinessException without rollback annotation -> all resorces are committed
- fail, RuntimeException or B.Exception with rollback annotation -> all resources are rolled back
So the behavior is correct.
You might use BeanManagedTx or you mark your CMT Beans accordingly.
E.g. Main SLSB without transaction call different SLSB's to charge and perform action 'that cost money'
This will work in all JEE conform servers in the same way.
Also I suppose that the AS5 and AS6 might also different in that case.