I think that the LazyInitializationException occurs when you try to access a property of your object outside the hibernate session. In fact, imagine you have 2 mapped objects: employee and company => in this example, an employee has only one company. First of all, you load the employee with the id 1. In the lazy mode, the associated company is not loaded. If you do not close the current hibernate session, if you do a "employee.getCompany()", hibernate will use the session to load the company object. BUT if you close the session and after if you do the "employee.getCompany()" statement, you'll get the LazyInitializationException. The solution would be to keep the hibernate session in the session scope but I find this solution very dirty. Another solution is to create the session when the page begins to render and to close it when the rendering is finished (not tested so....). I hope that my explanation was rather clear ;-)))
Did ----- Original Message ----- From: "Juan Esteban Maya" <[EMAIL PROTECTED]> To: "Tapestry users" <[email protected]>; "pepone pepone" <[EMAIL PROTECTED]> Sent: Tuesday, May 17, 2005 1:00 PM Subject: Hibernate + Spring: LazyInitializationException > Hi.. > I have been trying to use Tapestry with Spring + Hibernate 3. > I have follow the wiki help about this issue, but i keep getting a > LazyInitializationException everytime i load a lazy relation. Is there > anything more needed to get hibernate lazy loading working? > > Thanks in advance > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
