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

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  
  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);

The same is true for EnhancedLazyResultLoader

Thanks in advance,

View raw message