Defaults for <settings/> element aren't applied if it doesn't exist
-------------------------------------------------------------------

                 Key: IBATIS-436
                 URL: https://issues.apache.org/jira/browse/IBATIS-436
             Project: iBatis for Java
          Issue Type: Bug
          Components: SQL Maps
    Affects Versions: 2.3.0
         Environment: iBatis 2.3.0, Java 1.5, Spring 2.0.7
            Reporter: Nilesh Kapadia


If you don't include <settings> element in sqlMapConfig, the defaults (that are 
described in the documentation) aren't properly applied.  This definitely 
applies to cacheModelsEnabled setting.  cacheModelsEnabled is false if you 
don't have a <settings> element, and true if you do.  I have not looked at 
whether this affects other elements (I'd imagine all booleans that are supposed 
to default to true are affected).

The problem appears to be that when the <settings> element doesn't exist, most 
of the code in addSettingsNodelets() method in SqlMapConfigParser does not 
execute (the anonymous class and method that implements Nodelet never 
executes).  It appears that this code is where the defaults are normally 
applied.

In SqlMapExecutorDelegate, the isCacheModelsEnabled() method is returning false 
because the boolean cacheModelsEnabled is never set and thus defaults to false.

The workaround is of course to include <settings/> in sqlMapConfig.  But most 
examples out there don't include this element, so there is the possibility that 
many apps are running with the incorrect defaults.

I have not checked if this issue exists in previous versions, only looked at 
2.3.0 so far.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to