Date: 2004-04-20T02:32:27
   Editor: 194.175.229.106 <>
   Wiki: DB Torque Wiki
   Page: FrequentlyAskedQuestions
   URL: http://wiki.apache.org/db-torque/FrequentlyAskedQuestions

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -10,8 +10,7 @@
 
 Question: How can I configure Torque to use a JNDI connection
 
-Answer: Read the Torque Howto for indepth information.  However, here is the short 
howto!
- *  Torque.properties:
+Answer: Read the Torque Howto for indepth information.  However, here is the short 
howto! *  Torque.properties:
 {{{ torque.database.default.adapter=mssql 
  torque.dsfactory.default.factory=org.apache.torque.dsfactory.JndiDataSourceFactory 
  torque.dsfactory.default.jndi.path=java:comp/env/jdbc/fortius }}}
@@ -205,5 +204,21 @@
 What if I want save of multiple entities to be wrapped in single transaction
 -- Kalpesh Soni [EMAIL PROTECTED]
 
-Answer: ????
+Answer: Use Transaction yourself:
+{{{
+java.sql.Connection connection = null;
+try {
+  connection = org.apache.torque.util.Transaction.begin("torques_name_of_db");
+  someObject.save(connection);
+  someOtherObject.save(connection);
+  org.apache.torque.util.Transaction.commit(connection);
+}
+catch (Exception e) {
+  org.apache.torque.util.Transaction.safeRollback(connection);
+}
+}}}
+torques_name_of_db must be replaced with the database's name from torque's 
configuration files. The save(connection) methods are implemented in Torque's 
autogenerated base classes (where also the "usual" save() - Methods are), so you don't 
have to implement these by yourself.
+
+-- Thomas Fischer
+
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to