Hibernate Exception Fixed By Alt+Tab
- by Lee Theobald
Hi all,
I've got a very curious problem in Hibernate that I would like some opinions on. In my code if I do the following:
Go to page A
Click a link on page A to be taken to page B
Click on data item on page B
Exception thrown
I get an error telling me:
failed to lazily initialize a collection of role: XYZ, no session or session was closed
Fair enough. But when I do the same thing but add an alt+tab in the middle, everything is fine. E.g.
Go to page A
Click a link on page A to be taken to page B
Hit ALt+Tab to switch to another application
Hit ALt+Tab to switch back to the web browser
Click on data item on page B
Everything is fine.
I'm a little confused as to how switching focus from my application makes it act as I want it to. Does anyone have any light to shine on the subject? I don't think it's a locking issue as even if I do the second set of steps quicker than the first, still no error.
It's a Seam application using Hibernate 3.3.2.GA & 3.4.0.GA.