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
- AutoResultMap enhancement (map myField -> my_field) Richard Rattigan
-