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 <[EMAIL PROTECTED]> 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. > > It would be nice to have an option to support this convention globally > (e.g. <settings useUnderscores="true" />. The option would assume that a > property names MY_FIELD maps to a property called myField. For even more > flexibility, you could allow custom column name mapper to be specified (a la > hibernate) - using a similar approach to TypeHandlers. > > The benefit is that it could eliminate a lot of aliasing that is currently > required in SqlMaps when using this convention. > > Also, would it be possible to allow a <resultMap/> to use the AutoResultMap > behaviour for properties that aren't specified in the mapping. This > behaviour could be specified as follows. <resultMap ... auto="true"/> This > would simplify result mapping where only a couple of properties deviate from > the default. > > Cheers, > Richard > >
