Following discussion on the user's list here are the necessary patches
to enable multiple runtime database instances for the same om set.
Regards,
Malcolm Kendall

--- build.properties.orig       2004-01-06 20:01:19.966916800 +0100
+++ build.properties    2004-01-06 20:10:13.273774400 +0100
@@ -89,6 +89,12 @@
 #   key relationships. If this is not desired (because the underlying objects
 #   can be manipulated from other code), set this property to false. This currently
 #   cannot combined with the manager setting from above.
+#
+# useRunTimeDefaultDatabaseName
+#   if true, Torque generates peer classes and mapbuilder classes that use the 
+#   default database name as the runtime database. So you can use the same set 
+#   of om classes with different runtime database instances.
+#   
 # -------------------------------------------------------------------
 
 torque.targetPackage = org.apache.torque
@@ -102,6 +108,7 @@
 torque.useClasspath = false
 torque.useManagers = false
 torque.objectIsCaching = true
+torque.useRunTimeDefaultDatabaseName = false
 
 # -------------------------------------------------------------------
 #
--- MapBuilder.vm.orig  2004-01-06 20:01:23.642201600 +0100
+++ MapBuilder.vm       2004-01-06 20:16:42.373272000 +0100
@@ -58,7 +58,11 @@
      */
     public void doBuild() throws TorqueException
     {
-        dbMap = Torque.getDatabaseMap("$table.Database.Name");
+       #if (!$useRunTimeDefaultDatabaseName)
+       dbMap = Torque.getDatabaseMap("$table.Database.Name");
+       #else
+       dbMap = Torque.getDatabaseMap(Torque.getDefaultDB());
+       #end
 
         dbMap.addTable("$table.Name");
         TableMap tMap = dbMap.getTable("$table.Name");
--- Peer.vm.orig        2004-01-06 20:14:49.581084800 +0100
+++ Peer.vm     2004-01-06 20:11:48.530747200 +0100
@@ -53,7 +53,11 @@
 #if (!$table.isAlias())
 
     /** the default database name for this class */
+    #if (!$useRunTimeDefaultDatabaseName)
     public static final String DATABASE_NAME = "$table.Database.Name";
+    #else
+    public static final String DATABASE_NAME = Torque.getDefaultDB();
+    #end
 
      /** the table name for this class */
     public static final String TABLE_NAME = "$table.Name";

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

Reply via email to