View Full Version : HttpInvoker & Hibernate
Dec 22nd, 2004, 06:32 AM
I have tried to get lazy initialization of Hiberntate collections to work from HttpInvoker calls with no luck. Questions: Is this possible at all? If so, what is the required configuration steps?
To the Spring Team: Fantastic framework, well done!!
Dec 22nd, 2004, 01:09 PM
You mean that Hibernate would actually lazy load data via the remote connection? That doesn't work, and there is no way to make this work, as far as I see. The Hibernate Session that originally loaded the object with lazy references needs to be still active to allow for lazy loading; this can never be the case in a remote scenario, I'm afraid.
HTTP Invoker should properly serialize Hibernate collections, though, no matter whether they're loaded or not. When touching a collection on the remote client, you should get a standard Hibernate LazyInitializationException rather than some deserialization failure.
Dec 22nd, 2004, 02:47 PM
If this could work, it would be the holy grail!
Dec 23rd, 2004, 03:26 AM
Yes, at first i thought this isn't doable. But then I came across the following lines in the Spring documentation.
Hessian and/or Burlap might provide significant value when operating in a heterogenous environment, because they explicitly allow for non-Java clients. However, non-Java support is still limited. Known problems include the serialization of Hibernate objects in combination with lazily initializing collections. If you have such a data model, consider using RMI or HTTP invokers instead of Hessian.
Maybe it's just me and my poor english skills, but in my head it sounded like HTTP Invokers could actually do lazy init. of Hibernate collections.
anyways: Thanks for the fast reply, and for resolving my initially silly issue :)
Apr 6th, 2009, 02:25 AM
Juergen, it seems to me your post implies that the Hibernate session is not being closed before the HTTP Invoker request has been completely processed on the server side, correct? I'm using JPA's entity manager instead of Hibernate directly and it seems that the entity manager (and thus the Hibernate session) is being closed before the service method, called throught HTTP Invoker, exits. Therefore, I'm getting a LazyInitializationException when I try to serialize a Hibernate collection as a return value for the invocation. Any thoughts on this?
May 5th, 2012, 09:31 AM
you can get solution from http://code.google.com/p/rich-hibernate-lazy/
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.