Results 1 to 6 of 6

Thread: HttpInvoker & Hibernate

  1. #1
    Join Date
    Dec 2004
    Posts
    4

    Default HttpInvoker & Hibernate

    Hi,

    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!!

    regards
    Leif-Arne

  2. #2
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    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.

    Juergen

  3. #3
    Join Date
    Dec 2004
    Posts
    14

    Default But

    If this could work, it would be the holy grail!

    +1

  4. #4
    Join Date
    Dec 2004
    Posts
    4

    Default

    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

    LA

  5. #5
    Join Date
    Jan 2009
    Posts
    4

    Default

    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?

    Thanks!
    -Jonas

  6. #6
    Join Date
    Nov 2005
    Posts
    5

Similar Threads

  1. httpInvoker and Hibernate
    By maciuf in forum Remoting
    Replies: 1
    Last Post: Aug 14th, 2005, 01:43 AM
  2. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  3. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  4. Replies: 9
    Last Post: Sep 25th, 2004, 12:35 PM
  5. Replies: 7
    Last Post: Aug 21st, 2004, 03:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •