db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1098710 - /db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/primaryKeyMethods.vm
Date Mon, 02 May 2011 18:19:48 GMT
Author: tfischer
Date: Mon May  2 18:19:48 2011
New Revision: 1098710

URL: http://svn.apache.org/viewvc?rev=1098710&view=rev
Log:
fix handling of non-integer number primary keys

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

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/primaryKeyMethods.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/primaryKeyMethods.vm?rev=1098710&r1=1098709&r2=1098710&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/primaryKeyMethods.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/primaryKeyMethods.vm
Mon May  2 18:19:48 2011
@@ -58,15 +58,19 @@
     {
   #if($columnFieldType == "java.math.BigDecimal")
         ${setter}(((NumberKey) key).getBigDecimal());
+  #elseif ($columnFieldType == "Short")
+        ${setter}(Short.valueOf(((NumberKey) key).shortValue()));
+  #elseif ($columnFieldType == "Integer")
+        ${setter}(Integer.valueOf(((NumberKey) key).intValue()));
+  #elseif ($columnFieldType == "Long")
+        ${setter}(Long.valueOf(((NumberKey) key).longValue()));
+  #elseif ($columnFieldType == "Byte")
+        ${setter}(Byte.valueOf(((NumberKey) key).byteValue()));
   #elseif ($number == "true")
     #if ($primitive == "true")
         ${setter}(((NumberKey) key).${columnFieldType}Value());
     #else
-      #if ($columnFieldType == "Integer")
-        #set ( $valueMethod = "intValue")
-      #else
-        #set ( $valueMethod = "${columnFieldType.substring(0,1).toLowerCase()}${columnFieldType.substring(1)}Value"
)
-      #end
+      #set ( $valueMethod = "${columnFieldType.substring(0,1).toLowerCase()}${columnFieldType.substring(1)}Value"
)
         ${setter}(new ${columnFieldType}(((NumberKey) key).${valueMethod}()));
     #end
   #elseif($columnFieldType == "String")



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


Mime
View raw message