Hi, probally my question is stupid, but i don't found the solution serching on forum and Spring docs...
I'v a class A that is relationed to class B with n-n relation; with hibernate when i add an B instance to A i use this code:
A a = (A)session.load(A.class,aId);
B b = (B)session.load(B.class,bId);
a.getBs().add(b);
session.update(a);
Now if i use Spring (HibernateDaoSupport for example) and try to realize the equivalent code:
A a = (A) getHibernateTemplate().load(A.class,aId);
B b = (B)getHibernateTemplate().load(B.class,bId);
a.getBs().add(b);
throws an Exception because the b collection is lazy loaded and the session is closed.
I try to use HibernateCallback but the problem is same...
Note this DAO is used by a SessionBean and i don't would that the session is always open for client request (ex. OpenSessionInView)
Thanks in advance!
Alessio


Reply With Quote
) my applicationContext.xml like this: