Dec 4th, 2009, 04:59 AM
HibernateTemplate and lazyloading
I have many problems integrating hibernate and spring connected with Data Access Layer connected with lazyloading. I have been searching the web but I did not find a solution. I want to use HibernateTemplate to lazy load object. I want to do this thanks to OpenSessionInViewInterceptor, but it seems that HibernateTemplate close the session after do DAO service like SaveOrUpdate method and this Interceptor is not able to work. I really have not found any complete solution on web. Is it really possible to use hibernateTemplate with OpenSessionInViewInterceptor?
Because this approach did not result in any success I have tried another approach. I wanted to use pure session managament and its pure method like so:
I did not close the session and it seems that I was not getting famous LazyLoadingException, but in this approach I dont know why but saveOrUpdate does not bother @OneToMany(cascade = CascadeType.ALL) annotations, and it does not cascade saving childs.
I really dont know what to do. I dont want to use Eager loading.