Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3
Name and version of the database you are using: MySQL
Here's a simple question.
(1) Suppone we have a 'one to many' relationship:
class A has a set of class B, and class B has one reference to class A.
(2) We start a session, and we do a query "from A". It returns a
list of 'A' objects, right?
(3) So we get an 'A' object from the returned list and we can do a.getProperty1(), a.getProperty2(), and even a.getB().getProertyB1()...
Everything is right at this point.
But if we close the session after (2) and before (3), we can still do a.getProperty1(), a.getProperty2(), but we can't do a.getB().getPropertyB1() because B is still part of the closed session!
The exception thrown is: could not initialize proxy - the owning Session was closed
How can I get a.getB().getPropertyB1() after I close the session? And please, don't tell me to leave the session opened because I can't do that in my particular case.
Thanks in advance.