Announcement Announcement Module
Collapse
No announcement yet.
HttpInvoker & Hibernate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment


    • #3
      But

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

      +1

      Comment


      • #4
        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

        Comment


        • #5
          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

          Comment


          • #6
            you can get solution from http://code.google.com/p/rich-hibernate-lazy/

            Comment

            Working...
            X