logo       

Re: Custom collection serializer: msg#00013

Subject: Re: Custom collection serializer
Scott Ferguson wrote (2007-11-05 17:09):
On Nov 2, 2007, at 5:14 AM, Mattias Jiderhamn wrote:

  
... among other things I want to transfer over the service are collections from/in Hibernate objects. That is, the collections are
instances of Hibernates PersistentMap, PersistentList, PersistentSet etc. This will cause trouble, since the receiving end will think the
collection is not yet initialized, but it is also not bound to a  session and thus an exception will be throws (for search enginge indexing, I'm
talking about the LazyInitializationException , "failed to lazily initialize a collection, no session or session was closed").

In my current case, I can easily wrap the PersistentMap in a HashMap to avoid the issue, but then (apart from the tiny performance loss)
suddenly it is not as beatifully transparent anymore. I'm thinking there must be a way to tell Hessian to serialize the PersistentMap as a  
Map of unknown kind (which will be deserialized as a HashMap) using a custom serializer. There seems to be a way to set the SerializerFactory of  
the HessianServlet and/or addFactory() to the SerializerFactory. What would be the most correct way of doing this?

There's a setSendCollectionType(boolean) in the SerializerFactory and  
HessianServlet.  If you set it to false, it will serialize the  
collection as a raw list.
As far as I can tell from looking at the code, there is no such thing for Maps, which is what I need right now.
That is, I would need a com.caucho.hessian.io.MapSerializer.setSendJavaType().

I have added this here: http://bugs.caucho.com/view.php?id=2149

It does look like you'd need to extend HessianServlet to set it, though.
  
Mentioned that in the report above too.

 /Mattias
_______________________________________________
hessian-interest mailing list
hessian-interest-p4ZHcaHNc0TQT0dZR+AlfA@xxxxxxxxxxxxxxxx
http://maillist.caucho.com/mailman/listinfo/hessian-interest
Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.drivers.b...    security.firewa...    mathematics.lps...    web.zope.plone....    x25/2005-12/msg...    culture.tv.sout...    pld.user.polish...    qplus.devel/200...    version-control...    openbsd.bugs/20...    distributions.g...    gnu.chess.bugs/...    redhat.release....    emacs.bugs/2002...    java.bio.genera...    ataraid/2005-01...    finance.moneyda...    hardware.microc...    netbsd.ports.xe...    bug-tracking.gn...    text.xml.saxon....    kde.linux/2002-...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo