Hi,
This is thrown from the transaction
manager on setRollbackOnly() when the
transaction has already been rolled
back.
But the context should catch and
ignore this exception. If not, it is
a bug.
According to the CVS logs, this was
fixed 2000/10/08.
Try downloading a more recent version.
Best Regards,
Ole Husgaard.
boz jennings wrote:
>
> Howdy!
>
> I'm new to this list and want to start off saying that digging into
> jBoss has been fun stuff! Thanks to all involved for bringing this
> product along!!
>
> I have a container managed transaction (CMT) session bean that does a
> little money transfer demo. In the transfer method I'd like to roll back
> if the "from" account will be < 0.00. I think I should be able to do
> this by calling context.setRollbackOnly() but when I use that I get an
> error:
> [BankBean] javax.transaction.RollbackException: Already rolled back.
>
> If I take the context.setRollbackOnly() call out
> InsufficientBalanceException gets thrown but no rollback happens and the
> account gets a negative balance.
>
> Could someone please give me a clue?
>
> TIA,
> Boz
>
> Here's the whole method:..........................
>
> public void transferToSaving(double amount)
> throws InsufficientBalanceException // extends Exception
> {
>
> checkingBalance -= amount;
> savingBalance += amount;
>
> try {
> updateChecking(checkingBalance);
> if (checkingBalance < 0.00) {
> context.setRollbackOnly();
> throw new InsufficientBalanceException();
> }
> updateSaving(savingBalance);
> } catch (SQLException ex) {
> throw new EJBException
> ("Transaction failed due to SQLException: "
> + ex.getMessage());
> }
> }
>
> Here's a snip of the ejb-jar.xml:...........................
>
> ...
> <transaction-type>Container</transaction-type>
> ...
> <container-transaction>
> <method>
> <ejb-name>BankBean</ejb-name>
> <method-intf>Remote</method-intf>
> <method-name>transferToSaving</method-name>
> <method-params>
> <method-param>double</method-param>
> </method-params>
> </method>
> <trans-attribute>Required</trans-attribute>
> </container-transaction>
> ...
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]