码迷,mamicode.com
首页 > 编程语言 > 详细

Spring整合Hibernate遇到的错误

时间:2015-08-09 10:45:24      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:

            Error creating bean with name ‘transactionManager‘ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is

org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]

           Caused by: org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]

 

           报这个错误的原因是用了下面的配置

<property name="hibernateProperties" value="hibernate.properties"></property>

 

           改成

<property name="dataSource" ref="dataSource"></property>   就可以了

 

 

 还有就是Sping3.x在整合Hibernate4.x的时候,尽量不要用org.springframework.orm.hibernate3下面的东西,换成org.springframework.orm.hibernate4吧,要不然会有很多莫名其妙的错误,会搞的头大的

Spring整合Hibernate遇到的错误

标签:

原文地址:http://www.cnblogs.com/nongmei/p/4714676.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!