Hi,
I am fairly new to Hibernate and am trying to develop a Swing application using Hibernate 3 to persist my domain objects. I am trying to design my application using "best practices" i.e. making sure there is a clean separation of layers etc.
My question relates to Lazy Initialisation of collections. I keep hitting a LazyInitializationException - I understand why - I am closing the session before accessing a collection that is lazily loaded. The question I have is where should I open and close the session. Also, I have a problem with having to open the session just because I have a collection that is lazily loaded. Surely there must be some way of automagically opening the correct session when I access the lazily loaded collection.
Sorry for not posting anything specific - I suppose this is a general design question. Thanks for all your hard work.
Malcolm
|