I was wondering if there is an alternative for the OpenSessionInViewFilter for non-webapps? I am using Hibernate and all of my DAO's extend HibernateDAO support. I need to have lazy loading capabilities, and I was wondering if there is anything that I can use to start a hibernate session at the beginning of a particular method (at the service layer) and close it at the end of the method. I want to make sure that whatever I use will be transparent to my DAO's.
I know that I can use the following code that I use in my Junit test cases, but I would prefer to leverage existing soutions if possible.
Session session = getSessionFactory().openSession();
TransactionSynchronizationManager.bindResource(get SessionFactory(), new SessionHolder(session));
Thanks,
jp4


Reply With Quote
, well if you find they are in the future, there's a little bit of tidying up you can do.
