Yesterday I got around to actually start working with Hessian, and let me just first say: Wow! This is how Web Services are supposed to be. No descriptors, no stub generation, just a couple of XML lines (I'm using Springs HessianProxyFactoryBean here) and the remoting is completely transparent to the code. It's possible there are SOAP API:s providing this too, since it was a couple of years since I actively developed SOAP services, but for now I'm really looking forward to using Hessian.
Anyway, 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? We are currently not using Resin IoC (as I said, we are using Spring), so I'd prefer a solution without it. Would that mean I have to subclass HessianServlet? Thanks in advance. P.S. While I'm writing: Is there a summary of the differences between Hessian 1 and 2, without having to study the specs? Are there reasons to choose either in a specific environment? /Mattias _______________________________________________ hessian-interest mailing list [email protected] http://maillist.caucho.com/mailman/listinfo/hessian-interest
