Announcement Announcement Module
Collapse
No announcement yet.
Hibernate lazy loading fails because of 2 contexts Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate lazy loading fails because of 2 contexts

    Hi,

    I'm getting Hibernate LazyInitializationException errors when calling a java service from Actionscript. I use two contexts: one for Spring MVC and the other for Flex remoting. The Flex messagehandler succeeds in calling the java service. After that I get the exception.

    My java console shows me that the java context retrieves the object and the joined classes without any errors.

    If I turn of eager fetching Flex succeeds in retrieving the (detached) object. What am I supposed to do?

    Code:
    Hibernate: select contact0_.id as id3_, contact0_.phone as phone3_, contact0_.firstname as firstname3_, contact0_.lastname as lastname3_, contact0_.address_id as address5_3_ from mydb.contact contact0_
    Hibernate: select address0_.id as id0_0_, address0_.streetname as streetname0_0_, address0_.city_id as city5_0_0_, address0_.zip as zip0_0_, address0_.number as number0_0_ from mydb.address address0_ where address0_.id=? query
    > Uiterdijksterweg java console debug: contact has address.streetname joined, Okay, now flex
    1    [tomcat-http--4] ERROR org.hibernate.LazyInitializationException  - failed to lazily initialize a collection of role: com.revised.domain.Address.contacts, no session or session was closed

  • #2
    Solved ... I found Martin Zoldano's blog

    http://martinzoldano.blogspot.com/20...exception.html

    Thanks Martin !

    Comment


    • #3
      Out of curiosity, what version of Spring BlazeDS are you using? This should be handled transparently (with a similar approach to Martin's) in Spring BlazeDS 1.5.0.M2.

      Comment


      • #4
        I used the release version (1.0.3.RELEASE).. not the milestone update.. Perhaps I should do that in the future.. Normally I'm not that eager to pick nightly builds

        Comment


        • #5
          Originally posted by VortexLWD View Post
          I used the release version (1.0.3.RELEASE).. not the milestone update.. Perhaps I should do that in the future.. Normally I'm not that eager to pick nightly builds
          Understood. RC1 and GA won't be far behind. But if you do get a chance to try the milestone, feedback is greatly appreciated.

          Comment

          Working...
          X