I'm using Spring's HibernateInterceptor for my DAOs, in order to get sessions attached to them. Here's an example of my TargetProxy:
The problem I have is, when I have controllers that need access to the DAOs, it's awkward to inject the DAOs through every time. I was mistakenly using MemberDAO.getInstance() in the code, until I realized the getInstance() call bypasses the HibernateInterceptor.
<bean id="MemberDAOTarget" class="org.phatcast.db.dao.MemberDAOImpl" factory-method="getInstance">
<bean id="MemberDAO" class="org.springframework.aop.framework.ProxyFactoryBean">
Is there an easy way to get access to these DAOs without constantly creating setDao() methods in every controller, and changing the XML around? Is anyone is directly looking up the beans in the ApplicationContext? Or any other thoughts?
I would very much appreciate it if anyone had advice as to the best way to use HibernateInterceptor.