Spring+Hibernate, Autowire sessionFactory into hibernate DAO

本秂侑毒 提交于 2019-11-30 11:35:11

Did you declare sessionFactory bean?

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>file:src/hibernate.cfg.xml</value>
</property>
</bean>

I think your problem is @Autowired

@Autowired
private SessionFactory sessionFactory;
 @Autowired
 private SessionFactory sessionFactory;

 public void setSessionFactory(SessionFactory sessionFactory) {
     this.sessionFactory = sessionFactory;
 }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!