Author: tfischer
Date: Sat Jan 21 03:23:14 2012
New Revision: 1234257
URL: http://svn.apache.org/viewvc?rev=1234257&view=rev
Log:
Handle null values correctly
Modified:
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm
Modified:
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm?rev=1234257&r1=1234256&r2=1234257&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm
(original)
+++
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm
Sat Jan 21 03:23:14 2012
@@ -38,6 +38,8 @@
* @param resultSet the ResultSet to read from, not null.
* @param columnIndex the index in the resultSet which should be read.
*
+ * @return the content of the column.
+ *
* @throws SQLException if a problem occurs when reading
* from the resultSet.
*/
@@ -69,7 +71,16 @@
return false;
}
#else
+ #if ($primitive == "true" || $fieldType == "String")
return resultSet.${resultSetGetter}(columnIndex);
+ #else
+ ${fieldType} value = resultSet.${resultSetGetter}(columnIndex);
+ if (resultSet.wasNull())
+ {
+ value = null;
+ }
+ return value;
+ #end
#end
}
catch (SQLException e)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]