Lazy Load per result
--------------------

         Key: IBATIS-245
         URL: http://issues.apache.org/jira/browse/IBATIS-245
     Project: iBatis for Java
        Type: New Feature
  Components: SQL Maps  
    Versions: 2.1.5, 2.1.6    
 Environment: Any
    Reporter: S Boyd


I have a need for the lazy load property on a per result basis.  Since it was 
listed on the wish list for 2.1.5, I attempted to add it to ibatis 2.1.5 
source.  The global lazyload setting would be the default setting for all 
results.  If the default setting is not desirable for a particular result, then 
you can override it by adding lazyLoad="true|false" to the result.  In doing 
so, I had to modify the sqlmap dtd and three java classes:  SqlMapParser, 
BasicResultMap, and BasicResultMapping.

SqlMapParser code additions:

368:  parser.addNodelet("/sqlMap/resultMap/result", new Nodelet() {
// code skipped
379:     String callback = childAttributes.getProperty("typeHandler");
380:     String lazyLoad = childAttributes.getProperty("lazyLoad");

408:     BasicResultMapping mapping = new BasicResultMapping();
409:mapping.setPropertyName(propertyName);
        mapping.setColumnName(columnName);
        mapping.setJdbcTypeName(jdbcType);
        mapping.setTypeHandler(handler);
        mapping.setNullValue(nullValue);
        mapping.setStatementName(statementName);
        mapping.setNestedResultMapName(resultMapName);
                if(lazyLoad != null && lazyLoad.length() > 0){
                        mapping.setLazyLoad("true".equals(lazyLoad));
                }
                else{ // use global lazy load setting
                        
mapping.setLazyLoad(vars.client.getDelegate().isLazyLoadingEnabled());
                }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to