From torque-user-return-8011-apmail-db-torque-user-archive=db.apache.org@db.apache.org Mon Oct 13 16:45:43 2008 Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 72936 invoked from network); 13 Oct 2008 16:45:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Oct 2008 16:45:43 -0000 Received: (qmail 11944 invoked by uid 500); 13 Oct 2008 16:45:39 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 11912 invoked by uid 500); 13 Oct 2008 16:45:38 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 11898 invoked by uid 99); 13 Oct 2008 16:45:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Oct 2008 09:45:38 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 41.208.8.147 is neither permitted nor denied by domain of minfrin@sharp.fm) Received: from [41.208.8.147] (HELO rachel.sharp.fm) (41.208.8.147) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Oct 2008 16:44:31 +0000 Received: from rachel.sharp.fm (localhost.localdomain [127.0.0.1]) by rachel.sharp.fm (Postfix) with ESMTP id 72CF8980FD for ; Mon, 13 Oct 2008 18:41:59 +0200 (SAST) Received: from Macintosh.config (87-194-125-15.bethere.co.uk [87.194.125.15]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: minfrin@sharp.fm) by rachel.sharp.fm (Postfix) with ESMTPSA id 98888980FB for ; Mon, 13 Oct 2008 18:41:47 +0200 (SAST) Message-ID: <48F37AED.2040900@sharp.fm> Date: Mon, 13 Oct 2008 18:44:29 +0200 From: Graham Leggett User-Agent: Thunderbird 2.0.0.17 (Macintosh/20080914) MIME-Version: 1.0 To: Apache Torque Users List Subject: Re: Torque and JTA References: <48E22F9F.1020903@sharp.fm> <48E295E5.1040903@sharp.fm> <20080930213107.F40709@minotaur.apache.org> In-Reply-To: <20080930213107.F40709@minotaur.apache.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP X-Virus-Checked: Checked by ClamAV on apache.org Thomas Fischer wrote: >> 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. > > Does this mean that it is even an error to pass the connection around ??? No, it means it's an error to try and use the transactional calls on the connection. If you're using JTA, I understand that you should not call the transactional methods on JDBC. In short, if you want to use JTA with Torque, you must use Torque.getConnection() to get a connection, then pass that connection to all torque methods while the transaction is in progress, then finally, call Torque.closeConnection(conn) when you are done. Practically, you need to make sure that while your JTA transaction is active, torque doesn't try and perform any transactions on a second connection in the same thread. If you do you will get an explicit exception at the place where the second connection is used, so finding these bugs is pretty simple. To sum up: yes you can use JTA and Torque together, just make sure you use one connection per thread. Regards, Graham -- --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org