You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by cb...@apache.org on 2005/12/18 16:42:06 UTC
svn commit: r357473 -
/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/mapping/result/BasicResultMap.java
Author: cbegin
Date: Sun Dec 18 07:42:03 2005
New Revision: 357473
URL: http://svn.apache.org/viewcvs?rev=357473&view=rev
Log:
Fixed IBATIS-221 Can't store a List in a Map
Modified:
ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/mapping/result/BasicResultMap.java
Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/mapping/result/BasicResultMap.java
URL: http://svn.apache.org/viewcvs/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/mapping/result/BasicResultMap.java?rev=357473&r1=357472&r2=357473&view=diff
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/mapping/result/BasicResultMap.java (original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/mapping/result/BasicResultMap.java Sun Dec 18 07:42:03 2005
@@ -298,7 +298,11 @@
if (resultClass == null) {
throw new SqlMapException("The result class was null when trying to get results for ResultMap named " + getId() + ".");
} else if (Map.class.isAssignableFrom(resultClass)) {
- columnValues[i] = getNestedSelectMappingValue(request, rs, mapping, Object.class);
+ Class javaType = mapping.getJavaType();
+ if (javaType == null) {
+ javaType = Object.class;
+ }
+ columnValues[i] = getNestedSelectMappingValue(request, rs, mapping, javaType);
} else if (DomTypeMarker.class.isAssignableFrom(resultClass)) {
Class javaType = mapping.getJavaType();
if (javaType == null) {
@@ -559,6 +563,9 @@
value = typeHandler.getResult(rs, columnIndex);
} else {
value = typeHandler.getResult(rs, columnName);
+ }
+ if (value == null && nullValue != null) {
+ value = typeHandler.valueOf(nullValue);
}
} else {
throw new SqlMapException("No type handler could be found to map the property '" + mapping.getPropertyName() + "' to the column '" + mapping.getColumnName() + "'. One or both of the types, or the combination of types is not supported.");