ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: Case sensitivity in DefaultResultSetHandler
Date Fri, 02 Oct 2009 20:40:32 GMT
Wow, someone is using trunk!  Crazy, but awesome.
Unfortunately, by coincidence, I'm currently rewriting the entire
DefaultResultSetHandler -- in a serious way.  It's currently in a real state
of flux.

I'll work on it this weekend some more to try to get it to a Beta 4.  Your
feedback will come in handy for sure.

Clinton

On Fri, Oct 2, 2009 at 12:56 PM, Martin Ellis <martin@ellis.name> wrote:

> 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: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Mime
View raw message