-
Dec 4th, 2009, 04:59 AM
#1
HibernateTemplate and lazyloading
Hello,
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:
session.saveOrUpdate(user);
session.flush();
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.
Best regards,
grzdylsyn
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules