ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Morearty, Brian" <Brian_Morea...@intuit.com>
Subject IBator mapper calls all getters, not just the ones it needs
Date Wed, 21 Apr 2010 01:14:37 GMT


I'm using iBATIS 3 with a IBator 1.2.2. 


I used IBator to generate my models in Eclipse. Then I added some more
functions to the code-generated classes, taking advantage of the nifty
feature where it doesn't clobber my changes.


I've just discovered that when I call insertSelective(), it seems that
all public getters in my model are called-regardless of whether they're
needed for the insert. This is bad since some of the getters do
lazy-evaluation and may slow things down.


Is this by design, or perhaps (fingers-crossed) a known bug that has
been fixed since I compiled IBator 1.2.2 a month and a half ago?


I found the culprit in DynamicContext.java. It calls all the getters,
regardless of whether they will be needed:


  public DynamicContext(Configuration configuration, Object
parameterObject) {

    if (parameterObject != null && !(parameterObject instanceof Map)) {

      MetaObject metaObject =

      String[] names = metaObject.getGetterNames();

      for (String name : names) {

        bindings.put(name, metaObject.getValue(name));



    bindings.put(PARAMETER_OBJECT_KEY, parameterObject);




Any chance there's a quick fix for this?




Brian Morearty | Grow Your Business Division, Intuit | Staff Software
Engineer | direct 650-944-6852 


View raw message