ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Friedrich <stephen.friedr...@fortis-it.eu>
Subject Re: AutoResultMap enhancement (map myField -> my_field)
Date Wed, 11 Nov 2009 07:56:19 GMT
Hm, I don't understand the internals well enough to really understand that.
Sure name resolution is table specific?!

To work around the issue for my specific use case I patched this method in Reflector:
  public String findPropertyName(String name) {
      String propertyName = caseInsensitivePropertyMap.get(name.toUpperCase());
      if (propertyName == null) {
          propertyName = caseInsensitivePropertyMap.get(name.toUpperCase().replace("_", ""));
      return propertyName;

Seems to work for me, but of course I don't advocate this as a general solution.


Von: Clinton Begin [mailto:clinton.begin@gmail.com]
Gesendet: Mittwoch, 11. November 2009 05:30
An: user-java@ibatis.apache.org
Betreff: Re: AutoResultMap enhancement (map myField -> my_field)

I decided not to go there.  It created new challenges.  That's not to say it can never be
there... but it's not as easy as it looks.  The biggest problem is with columns like "id",
where multiple tables use the same column name.

But that's just one challenge...

On Tue, Nov 10, 2009 at 4:54 PM, stephen.friedrich <stephen.friedrich@fortis-it.eu<mailto:stephen.friedrich@fortis-it.eu>>

Any news on this?
I haven't found any pluggable name resolver in 3.0 (Beta 5)?!
This would make my SQL much shorter and more readable (omitting all those

Clinton Begin wrote:
> This is definitely something I've wanted to do for a while.  Version 3
> will
> have a property/column name resolver that can be overridden.  It's not
> terribly hard to put in 2.x, but it might be a while before anyone has the
> time..
> The default name resolver would support underscores, uppercase, lowercase
> and table prefixex etc.
> Clinton
> On Wed, Jul 23, 2008 at 6:51 AM, Richard Rattigan <rattigan@broad.mit.edu<mailto:rattigan@broad.mit.edu>>
> wrote:
>> Hi,
>> I'm a new user of IBatis, and would like to suggest an enhancement to the
>> behaviour of AutoResultMap.
>> Currently, AutoResultMap maps a property column 'MYFIELD' to a column
>> 'myField', and maps a column 'MY_FIELD' to a property 'my_field' (or some
>> capitalized variant). This default behaviour is a little odd, since
>> databases usually use underscores to separate words in column names,
>> whereas
>> JavaBean properties use camel case.
>> ...
>> Cheers,
>> Richard

View this message in context: http://old.nabble.com/AutoResultMap-enhancement-%28map-myField--%3E-my_field%29-tp18610069p26293607.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org<mailto:user-java-unsubscribe@ibatis.apache.org>
For additional commands, e-mail: user-java-help@ibatis.apache.org<mailto:user-java-help@ibatis.apache.org>

View raw message