[Topaz-dev] serializing Article from Session.get()

Pradeep Krishnan pradeepk at soft-point.com
Fri Mar 7 17:38:29 PST 2008


Hi Jeff,

Jeff Suttor wrote:
> hi OTM folks,
> 
> any thoughts on why an Article returned by:
> 
> http://gandalf.topazproject.org/trac/browser/branches/0.8.2.2/plos/webapp/src/main/java/org/plos/article/service/ArticleOtmService.java#L516
> 
> would fail with:
> 
> http://www.topazproject.org/trac/ticket/806#comment:8
> 
> when serialized?
> 
> why would serializing an Article have anything to do w/serializing an
> OTM SessionFactory?  is this a case of Article actually being a
> proxy/stub/whatever?  do the fields of Article need to be accessed w/in
> the tx?  (thought we were over that?)
> 
> thanks for any guidance,
> 

Yes, this is due to proxies. The proxy class only exists in the jvm that 
generated it and therefore the proxy class can't be de-serialized on the 
other side. (Even though this specific error is now on serialization and 
we can take care of that easily) So what needs to be done somehow is to 
ensure that the proxy class somehow replaces the object that is 
serialized with an instance of its super-class. The alternatives that we 
could come up with all involves a copy/clone instance.

So don't have a good answer yet. In the mean time the ugly work around 
is to copy into a *Info class. I'll also do some experiments to see if a 
   solution in OTM can be put together by hacking around the java 
serialization.

Cheers,
Pradeep






More information about the Topaz-Dev mailing list