Hi,
I'm running into a problem using trunk, specifically with version:
r819833 | cbegin | 2009-09-29 06:43:58 +0100 (Tue, 29 Sep 2009) | 2 lines
Support single column mappings in primitive results
I have a SELECT statement that uses AS to name a few columns.
I have a resultMap that refers the AS names (not the DB column
names), which in turn maps to property names on a bean.
This all works hunky-dorey in 3.0.* releases, up to 3.0-beta-3.
But, in the releases, loading associations seems to be broken
in a way that I can't understand, which is why I'm trying trunk... :o)
In trunk, the association loading works as I'd expect, but
*something's* going wrong with all those renamings. There
seems to be a case sensitivity issue in
DefaultResultSetHandler#getRowValue().
It calls loadMappedAndUnmappedColumnNames, which
populates two lists with (uncapitalised) column names.
This is then passed to applyPropertyMappings, which
searches the same lists for upper-cased column names:
if (propertyMapping.isCompositeResult()
|| (column != null && mappedColumnNames.contains(column.toUpperCase()))) {
I've got stuff working as I'd like with the following change:
---
a/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java
+++
b/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java
@@ -265,9 +265,9 @@ public class DefaultResultSetHandler implements
ResultSetHandler {
final String columnName = configuration.isUseColumnLabel() ?
rsmd.getColumnLabel(i) : rsmd.getColumnName(i);
final String upperColumnName = columnName.toUpperCase();
if (mappedColumns.contains(upperColumnName)) {
- mappedColumnNames.add(columnName);
+ mappedColumnNames.add(upperColumnName);
} else {
- unmappedColumnNames.add(columnName);
+ unmappedColumnNames.add(upperColumnName);
}
}
}
I wonder if perhaps someone more familiar with the code could
check the logic there? I've been using iBATIS for all of about
a week, so unfortunately I'm not that familiar with its workings.
Best Regards,
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]