You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by jm...@chubb.com on 2005/06/10 15:01:19 UTC

torque transactions

What support does torque offer for transactions?
Does torque have an equivalent of a Hibernate Session or a JDO
PersistenceManager?

I am trying to integrate Torque with Spring so i need to learn if there is
any built in transaction support in Torque and what classes support this.

John Menke

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


RE: torque transactions

Posted by Thomas Fischer <fi...@seitenbau.net>.



Hi,

In Torque, transactions are handled via the class
org.apache.torque.util.Transaction and java.sql.Connection.

- To start a transaction, call Transaction.begin(String) to get a
connection of the desired database. If you want to use the default
database, call Transaction.begin(Torque.getDefaultDB()). It gives back a
java.sql.Connection object.
- To access the database in the transaction, use the connection object for
every action. There should be a method which takes a Connection for every
method which accesses the database. If you find a place where this is not
the case, complain to the Torque dev list.
-  To commit / rollback a tranaction, use Transaction.commit(Connection)
and tranaction.rollback(Connection). To rollback upon errors, use
Transaction.safeRollback(connection), which does not choke upon null
connection and does not throw any Exceptions.

   Thomas

jmenke@chubb.com schrieb am 10.06.2005 15:01:19:

> What support does torque offer for transactions?
> Does torque have an equivalent of a Hibernate Session or a JDO
> PersistenceManager?
>
> I am trying to integrate Torque with Spring so i need to learn if there
is
> any built in transaction support in Torque and what classes support this.
>
> John Menke
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


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