You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Jeremy Gray <jg...@siberra.com> on 2006/05/10 01:32:36 UTC

LazyLoadProxyFactory bug? Ignores listClass during attempt to build proxy

I think I may have found a bug in the more recent LazyLoadProxyFactory.
If the list type in the domain object implements IList and a listClass
is specified in the sql map, ibatis ignores the list class setting and
instead attempts to build a proxy for the list type defined in the
domain object. In our case, the domain objects for which we have been
lazy loading properties have had their exposed types set to IList (so
that we could trade off custom collections against lazy-loaded lists
just by changing the config) but the sql map has been set to use the
custom collection. Older versions of ibatis would ignore the lazyload
attribute when a listclass was present, but with the new
proxy-generating codebase, it reverses this, obeying the lazyload but
ignoring the listclass and trying to instead proxy the IList (which of
course fails).

 

The fix, based on my limited testing today, is quite simple, involving a
one line change from this (currently on line 95):

 

proxy =
ProxyGeneratorFactory.GetProxyGenerator().CreateClassProxy(typeProxified
, handler, Type.EmptyTypes);

 

to this:

 

proxy =
ProxyGeneratorFactory.GetProxyGenerator().CreateClassProxy(mappedStateme
nt.Statement.ListClass, handler, Type.EmptyTypes);

 

 

 

Jeremy Gray
Development Lead, SIMM Services
siberra
DIGITAL MEDIA SYSTEMS
Tel:  604-696-3230
jgray@siberra.com <ma...@siberra.com> 
www.siberra.com <http://www.siberra.com/>  

 


Re: LazyLoadProxyFactory bug? Ignores listClass during attempt to build proxy

Posted by Gilles Bayon <ib...@gmail.com>.
I known that I must polish the Lazy load support.
Could you give me an example of you domain objects and the mapping you are
using.

Thanks,
-Gilles


On 5/10/06, Jeremy Gray <jg...@siberra.com> wrote:
>
>  I think I may have found a bug in the more recent LazyLoadProxyFactory.
> If the list type in the domain object implements IList and a listClass is
> specified in the sql map, ibatis ignores the list class setting and instead
> attempts to build a proxy for the list type defined in the domain object. In
> our case, the domain objects for which we have been lazy loading properties
> have had their exposed types set to IList (so that we could trade off custom
> collections against lazy-loaded lists just by changing the config) but the
> sql map has been set to use the custom collection. Older versions of ibatis
> would ignore the lazyload attribute when a listclass was present, but with
> the new proxy-generating codebase, it reverses this, obeying the lazyload
> but ignoring the listclass and trying to instead proxy the IList (which of
> course fails).
>
>
>
> The fix, based on my limited testing today, is quite simple, involving a
> one line change from this (currently on line 95):
>
>
>
> proxy = ProxyGeneratorFactory.GetProxyGenerator().CreateClassProxy(typeProxified,
> handler, Type.EmptyTypes);
>
>
>
> to this:
>
>
>
> proxy = ProxyGeneratorFactory.GetProxyGenerator().CreateClassProxy(
> mappedStatement.Statement.ListClass, handler, Type.EmptyTypes);
>
>
>
>
>
>
>
> *Jeremy Gray*
> *Development Lead, SIMM Services*
> *siberra*
> DIGITAL MEDIA SYSTEMS
> Tel:  604-696-3230
> jgray@siberra.com
> www.siberra.com
>
>
>