Hibernate4 中已经没有HibernateDaoSupport了,所以DAO层按视频上写会有异常,可以这样试试:
public void save(Product product){
Session session = this.getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
session.save(product);
tx.commit();
session.close();
public void save(Product product){
Session session = this.getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
session.save(product);
tx.commit();
session.close();
2017-02-24
有没有老哥出现这个错误
严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
2017-02-22
最新回答 / 慕粉3763154
找到问题了吧 <prop key="hibernate.hdm2ddl.auto">update</prop>写错了 <prop key="hibernate.hbm2ddl.auto">update</prop>
2017-02-14