Is it possible to implement a DAO (with Hibernate queries) to return Proxy classes ?
Example :
public List getCompanyByName(final String name) {
Session session = SessionFactoryUtils.getSession(getSessionFactory() , false);
try {
return session.find("from Company company where company.name=?", name, Hibernate.STRING);
} catch (HibernateException e) {
e.printStackTrace();
}
return null;
}
This method return Company object and not the Proxy of the Company.
<bean id="companyImpl" class="CompanyImpl">
</bean>
<bean id="company" class="org.springframework.aop.framework.ProxyFact oryBean">
<property name="proxyInterfaces">
<value>Company</value>
</property>
<property name="target">
<ref local="companyImpl"/>
</property>
<property name="interceptorNames">
<list>
<value>debugInterceptor</value>
</list>
</property>
</bean>
Thanks...


Reply With Quote
