Author: tfischer
Date: Fri Oct  1 04:24:15 2010
New Revision: 1003383

URL: http://svn.apache.org/viewvc?rev=1003383&view=rev
Log:
make table attribute abstract work

Modified:
    
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm
    
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm

Modified: 
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm
URL: 
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm?rev=1003383&r1=1003382&r2=1003383&view=diff
==============================================================================
--- 
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm
 (original)
+++ 
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm
 Fri Oct  1 04:24:15 2010
@@ -146,7 +146,6 @@
      *        to already created objects
      * @return an instance of ${javaName} with the contents of bean
      */
-
     public static ${javaName} create${javaName}(${beanClassName} bean, 
IdentityMap createdObjects)
         throws TorqueException
     {
@@ -156,7 +155,22 @@
             // we already have an object for the bean, return it
             return result;
         }
+#if ($abstract == "true")
+        try
+        {
+            result = ($javaName) ${peerClassName}.getOMClass().newInstance();
+        }
+        catch (InstantiationException e)
+        {
+            throw new TorqueException(e);
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new TorqueException(e);
+        }
+#else
         result = new ${javaName}();
+#end
         createdObjects.put(bean, result);
 
 #foreach ($columnElement in $columnElements)

Modified: 
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm
URL: 
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm?rev=1003383&r1=1003382&r2=1003383&view=diff
==============================================================================
--- 
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm
 (original)
+++ 
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm
 Fri Oct  1 04:24:15 2010
@@ -36,7 +36,24 @@
 #if ($complexObjectModel)
         return copy(true);
 #else
-        return copyInto(new ${table.JavaName}());
+#if ($abstract == "true")
+        $dbObjectClassName copy;
+        try
+        {
+            copy = ($dbObjectClassName) 
${peerClassName}.getOMClass().newInstance();
+        }
+        catch (InstantiationException e)
+        {
+            throw new TorqueException(e);
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new TorqueException(e);
+        }
+#else
+        $dbObjectClassName copy = new ${dbObjectClassName}();
+#end
+        return copyInto(copy);
 #end
     }
 
@@ -65,7 +82,24 @@
      */
     public $dbObjectClassName copy(boolean deepcopy) throws TorqueException
     {
-        return copyInto(new ${dbObjectClassName}(), deepcopy);
+#if ($abstract == "true")
+        $dbObjectClassName copy;
+        try
+        {
+            copy = ($dbObjectClassName) 
${peerClassName}.getOMClass().newInstance();
+        }
+        catch (InstantiationException e)
+        {
+            throw new TorqueException(e);
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new TorqueException(e);
+        }
+#else
+        $dbObjectClassName copy = new ${dbObjectClassName}();
+#end
+        return copyInto(copy, deepcopy);
     }
 
     /**
@@ -80,7 +114,24 @@
      */
     public $dbObjectClassName copy(boolean deepcopy, Connection con) throws 
TorqueException
     {
-        return copyInto(new ${dbObjectClassName}(), deepcopy, con);
+#if ($abstract == "true")
+        $dbObjectClassName copy;
+        try
+        {
+            copy = ($dbObjectClassName) 
${peerClassName}.getOMClass().newInstance();
+        }
+        catch (InstantiationException e)
+        {
+            throw new TorqueException(e);
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new TorqueException(e);
+        }
+#else
+        $dbObjectClassName copy = new ${dbObjectClassName}();
+#end
+        return copyInto(copy, deepcopy, con);
     }
 #end
   



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to