Spring整合Hibernate遇到的错误

            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吧,要不然会有很多莫名其妙的错误,会搞的头大的

posted @ 2015-08-09 10:26  浓眉和叶孤橙  阅读(1122)  评论(0编辑  收藏  举报