db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alvin Antony" <Alvin.Ant...@internet.lmu.de>
Subject Antw: Re: Does Torque Support Transactions?
Date Wed, 14 May 2003 18:19:57 GMT

Hi,

You would have to use the Transaction class as shown below.

The dbName is the value of the "torque.database.default".

you can also use this method to retrieve the dbname used,

BasePeer.getMapBuilder().getDatabaseMap().getName()





 Connection con = null;
         try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }

     
regards,
Alvin

Alvin K. Antony
Ludwig-Maximilians-Universität München
Internet und Virtuelle Hochschule
Softwareentwicklung
Oettingenstraße 67
80538 München
Germany
-------------------------------------------
Phone: +49 (0)89 2102-5979
Fax: +49 (0)89 2102-5980
Mobile: +49 (0)175 9401175
E-Mail: aantony@lmu.de

Web: http://www.lmu.de/internet/


>>> johnd@purplebear.com 05/14 7:00  >>>
I did see the Transaction class, but it wasn't clear if it was an 
internally used class, or how to use it because the BeginTransaction 
call takes a database name, and right now I don't use the DB name 
anywhere in my code.  Has anyone used the Transaction class for doing 
Transactions with Torque generated objects?

John

On Wednesday, May 14, 2003, at 07:29  AM, Campbell, Justin wrote:

> John -
>
> Check out the Transaction class in the org.apache.torque.util
package.
> Sounds like what you're looking for.
>
> - Justin
>
> -----Original Message-----
> From: John Dietz [mailto:johnd@purplebear.com] 
> Sent: Tuesday, May 13, 2003 11:22 PM
> To: Turbine Torque Users List
> Subject: Does Torque Support Transactions?
>
>
> Does Torque support transactions such that I can make sure that if I
am
> inserting two records/objects that either they both get inserted, or
> neither do.  So can I start transactions, commit transactions, and
> rollback transactions from Torque?
>
> John Dietz
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org 
For additional commands, e-mail: torque-user-help@db.apache.org 


Mime
View raw message