db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Leggett <minf...@sharp.fm>
Subject Re: Torque and JTA
Date Tue, 30 Sep 2008 21:11:01 GMT
Thomas Fischer wrote:

> I am not really qualified to answer this, because I do not know how JTA 
> works internally. So use healthy scepticism with the answer below.
> With all external transaction frameworks, the problem is that at the 
> moment, Torque does not have a "Transaction Info" object which is passed 
> around in a transaction, it only passes a jdbc connection around (There is 
> a Transaction object but it does not contain information about the current 
> transaction). So the problem is that there is not really a way to pass 
> transaction info around.
> But maybe one can use a custom Data source providing a custom Connection 
> wrapper object which contains the connection information and the 
> transaction information. This would probably mean some ugly casts, and 
> patches to the Torque Transaction object, but perhaps it could work.

Again, this comes with the disclaimer that it's what I've figured out so 

 From what I have managed to gather so far is that jta works by 
requesting callbacks with the JDBC driver, and this means you don't need 
to explicitly pass around any connection object representing the 
transaction, the transaction is associated with the thread in which 
you're running.

All the developer needs to do as I understand it, if using the 
UserTransaction interface, is to call the begin(), commit() and 
rollback() methods to signal to jta whether you are done or not.

The underlying JDBC callbacks will be called to rollback a failed 
transaction if necessary, the caller doesn't need to worry about it.

 From the looking at the generated torque source, if you pass null as a 
Connection, torque will ignore all transactions, which is exactly in 
theory what jta wants torque to do.

Once I have managed to get it working, I'll be able to confirm whether 
my understanding is correct.


View raw message