smv
Oct 31st, 2004, 02:29 PM
I am writing an application that will be using Spring-RCP for the user front-end, but not for the cron'd processes at night on the server. I have read many articles on Spring, DAOs, and lazy-loading, but the true answer seems to evade me.
I have my setup wired with a data source to HSQLDB (moving to Oracle once more of the application has been developed), LocalSessionFactoryBean to Hibernate, HibernateInterceptor, HibernateTransactionManager, TransactionInterceptor, and a ProxyFactoryBean.
In the DAO, I'm obtaining my own Session object from the SessionFactoryUtils class for each method which needs to read/write to the session.
In my Junit tests, I have a setUp and tearDown which opens and closes the Hibernate session as per an article I read on Karl Baum's blog. The tests work great with the lazy loading.
If this were a web application, I could just use the OpenSessionInView(Interceptor/Filter), but that still doesn't help with my server processes which wouldn't run in the servlet context nor through a SimpleUrlHandlerMapper.
So with my two requirements, Spring-RCP and cron'd server processes, what is the best way to wrap a session around my processes? I have looked at AOP, but I have no idea how that is wrapped around a method call.
Any tips or direction would be greatly appreciated.
Thank you,
smv
I have my setup wired with a data source to HSQLDB (moving to Oracle once more of the application has been developed), LocalSessionFactoryBean to Hibernate, HibernateInterceptor, HibernateTransactionManager, TransactionInterceptor, and a ProxyFactoryBean.
In the DAO, I'm obtaining my own Session object from the SessionFactoryUtils class for each method which needs to read/write to the session.
In my Junit tests, I have a setUp and tearDown which opens and closes the Hibernate session as per an article I read on Karl Baum's blog. The tests work great with the lazy loading.
If this were a web application, I could just use the OpenSessionInView(Interceptor/Filter), but that still doesn't help with my server processes which wouldn't run in the servlet context nor through a SimpleUrlHandlerMapper.
So with my two requirements, Spring-RCP and cron'd server processes, what is the best way to wrap a session around my processes? I have looked at AOP, but I have no idea how that is wrapped around a method call.
Any tips or direction would be greatly appreciated.
Thank you,
smv