dlr 2003/10/29 14:57:59
Modified: src/generator/src/templates/om Object.vm
Log:
* src/generator/src/templates/om/Object.vm
A schema like this:
<table name="FOO" idMethod="native" javaName="Foo">
...
<column name="COUNT" type="TINYINT" default="0"/>
...was resulting in Java code generated like this:
/**
* The value for the attachment_count field
*/
private Byte count = new Byte(0);
...which produced a compile error, since Byte has only constructors
for String and byte, not int. To fix, we cast the default value
from a primitive int to byte.
Revision Changes Path
1.9 +2 -0 db-torque/src/generator/src/templates/om/Object.vm
Index: Object.vm
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/templates/om/Object.vm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -u -r1.8 -r1.9
--- Object.vm 11 Sep 2003 22:51:39 -0000 1.8
+++ Object.vm 29 Oct 2003 22:57:59 -0000 1.9
@@ -93,6 +93,8 @@
#elseif ($cjtype == "StringKey")
#set ( $quote = '"' )
#set ($defVal = "= new StringKey($quote$defaultValue$quote)")
+ #elseif ($cjtype == 'Byte')
+ #set ($defVal = "= new ${cjtype}((byte) $defaultValue)")
#else
#if (!$col.isPrimitive() && $cjtype != "String")
#set ( $defaultValue = "new ${cjtype}($defaultValue)" )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]