Hello,
Here is my situation. I have three classes A, B, and C. Class A has a collection of B and B has a collection of C. I'm using Hibernate for persistence. I have mapped the collections as lazy - since most of them I don't need to retrieve the entire graph. I have DAO classes for each A, B, and C. Each DAO classes extends HibernateDaoSupport.
My problem is, for one case I need to retrieve the entire graph. After rereading the the docs and the forums, I realize that HibernateDaoSupport opens and closes the session for me and to avoid a LazyInitializationException I need to reattach the object to a session. Fair enough.
My question, is would it be a good idea to create an Intercepter on A.getB() and B.getC() that would make a call to Hibernate.initialize() ?
If not, or if there is a better idea, could someone direct me to sample code? I've looked at the Spring samples but there does not appear to be an example of using Hibernate with lazy collections.
Thanks.
