Hello again,

After figuring out my previous problem, I've got my iBATIS/JTA test
application working up to a point (start transaction, update followed
by end or commit).

Now, according to the book "iBATIS in Action", when configured to use
a JTA transactionManager, "iBATIS will look for the global transaction
context and attempt to manage it appropriately.  This means that
iBATIS can check the state of an existing transaction or start one if
necessary."  It also states that "you should still start, commit and
end the 'inner transaction scope'".

Given this, I'd expected to be able to write code like this;

       // start a transaction
       // [iBATIS starts a new JTA transaction...?]
       sqlMapClient.startTransaction();

       // ... do some database processing ...

       // start an inner transaction
       // [iBATIS joins the existing JTA transaction...?]
       sqlMapClient.startTransaction();

       // ... do some more database processing ...

       // abandon the inner transaction
       // [iBATIS issues setRollbackOnly on JTA transaction...?]
       sqlMapClient.endTransaction();

       // commit the outer transaction
       // [iBATIS issues commit on JTA transaction...?]
       sqlMapClient.commitTransaction();

with the final result that the database is unchanged.  However,
instead, I get an exception on my second call to startTransaction()
complaining that a transaction is already started.

Obviously what I'm ultimately looking to do is to coordinate a number
of distinct database interactions into a single transaction - but this
example demonstrates my problem, I think.

Can anybody suggest how I might achieve this?

Thanks again,


Alistair.

Reply via email to