摘要:
大家都知道,Hibernate升级到4.x以后,在Spring中,通过Hibernate访问数据库的方法已经发生了变化,不再是以往让自己的DAO实现类继承HibernateDAOSupport,然后使用getHibernateTemplate()方法,操作数据库。新的模式下,只能通过从Spring注... 阅读全文
posted @ 2014-12-26 22:53
Genji_
阅读(132)
评论(0)
推荐(0)
摘要:
在Spring中添加事物管理以后出现的问题源代码ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");UserDao userDao = (UserDa... 阅读全文
posted @ 2014-12-26 22:52
Genji_
阅读(2707)
评论(0)
推荐(0)
摘要:
Hibernate4 与 spring3 集成之后, 如果在取得session 的地方使用了getCurrentSession, 可能会报一个错:“No Session found for current thread”, 这个错误的原因,网上有很多解决办法, 但具体原因的分析,却没有多少, 这里转... 阅读全文
posted @ 2014-12-26 21:47
Genji_
阅读(237)
评论(0)
推荐(0)
java.lang.NoSuchMethodError:org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session
摘要:
项目配置了spring4.0.6.RELEASE 和hibernate4.2.0.Final ,出错原因是因为在Spring 3.1开始没有了HibernateDaoSupport类,而我的却Dao类继承了这个类。直接使用sessionFactory.getCurrentSession().方法或者... 阅读全文
posted @ 2014-12-26 20:49
Genji_
阅读(4736)
评论(0)
推荐(0)

浙公网安备 33010602011771号