I cant seem to figure out why the following problems are happening... Here's what I am trying to do: I am running a paint panel where I can draw whatever shapes i want in it and the Session will only save when user saves the work - so basically a Session can last a while without being committed. There are side panels where I can create shape objects that after creating them (while the paint session is going on) i want to drag them around and include as my drawing.
Error 1. Basically when I did not start a Paint Session and i create new shapes everything's fine. However, when I started the Paint Session i get this error when I try to commit another session to create the objects:
There is a method in my class that gets a new session using SessionFactory.openSession(); after i commit and try to save i get the following error. 33190 [http-8080-6] ERROR org.hibernate.LazyInitializationException - failed to lazily initialize a collection of role: foo.serviceImpl, no session or session was closed org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: foo.serviceImpl, no session or session was closed
Error 2: I found out that if I do a Commit in my Paint Session's Session object then the problem in Error 1 (object not shown ) gets solved but I dont want to commit changes in the pain section without user explicitly saving it.
It seems my Paint Session Session is somehow linked to the Object Session's Session. Not sure how that can be since the Object Session's Session is created in specific methods then disconnected/closed after use....
What I basically want is to have one Session that is open for a while while other sessions can be used to create new objects that the main Session can see the changes.
|