ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Shpak <o...@rap-x.com>
Subject Re: cache timeout
Date Thu, 04 Aug 2005 15:53:18 GMT
Hello,

I'm using lazy loading in iBatis, but this appears to fetch my object 
eagerly, effectively increasing the number of statements to exactly N+1. 
Lazy loading for collection does work however.
I did some research and found that iBatis does not create proxies for 
objects, only for collections.

Am I missing something? After reading the docs I thought that lazy 
loading applies to both objects and collections.

Here is what is going in 
com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader, lines  
66-74
----------------8<---------------
  public Object loadResult() throws SQLException {
    if (Collection.class.isAssignableFrom(targetType)) {
      InvocationHandler handler = new LazyResultLoader(client, 
statementName, parameterObject, targetType);
      ClassLoader cl = targetType.getClassLoader();
      return Proxy.newProxyInstance(cl, LIST_INTERFACES, handler);
    } else {
      return ResultLoader.getResult(client, statementName, 
parameterObject, targetType);
    }
  }
----------------8<---------------

The same is true for EnhancedLazyResultLoader

Thanks in advance,
Oleg






Mime
View raw message