ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Munat <b...@munat.com>
Subject Non-seriazable exception
Date Tue, 03 Jan 2006 00:08:33 GMT

I'm getting the NotSerializableException on com.ibatis....loader.LazyResultLoader when I restart
tomcat and it tries to 
write/read the serialized http session. The only discussion of this I've found in the mailing
list is this message 
Clinton posted back in November:

"Unfortunately you can't mix lazy loading with serializable caches....

This is not an iBATIS problem, but more of a CGLIB and/or Java problem.  I'm sure we could
find some crazy means of 
managing this, but I'd rather not.  The real solution is to tell Sun that we want dynamic
proxies for classes, just like 
we have for interfaces....and we want them to be serializable."

So, does "serializable cache" include the http session? I'm not trying to do anything fancy,
but I wouldn't mind being 
able to leave the lazy loading turned on either.

Also, to make sure I'm understanding this... the reason why an Ibatis class is being dragged
into the serialization in 
the first place is because lazy loading uses dynamic proxies, right? So my domain objects
are being wrapped with this 
proxy that catches a call for a child and invokes the query on the Ibatis code to get the
necessary data? And then, when 
  tomcat goes to serialize the domain object, it's actually getting the proxy and so it tries
to serialize the ibatis 
class.... right?

If so, then I suppose that I either have to somehow not put my domain objects in the session
or turn off lazy loading. 
Am I on track here?


View raw message