I have an object X which has a many-to-one relationship with Object Y. I could see it is working fine in the beginning, but it ended up with problems after some days in production.
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
- I collect these X objects in a list in my model.
- I iterate it with Struts tag in view, where I could see this error in log file.
The session I used in model got closed before I iterate the list in UI. The solution was given here. http://stackoverflow.com/questions/345705/hibernate-lazyinitializationexception-could-not-initialize-proxy
Changing the relationship as
lazy=false in HBM mapping solves this issue. Make sure it is getting inserted and deleted properly.