Cannot unwrap to requested type [javax.sql.DataSource]
生活随笔
收集整理的這篇文章主要介紹了
Cannot unwrap to requested type [javax.sql.DataSource]
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
為什么80%的碼農都做不了架構師?>>> ??
遇上這個bug我的情況是這樣,hibernate4以后,spring3.1不再有hibernateDaoSupport,在dao層不能繼承HibernateDaoSupport,
只能顯式聲明SessionFactory,并且設置get/set方法。
不確定的說:
?????? 在hibernate4以后,session管理變動較大,spring也變了,所以DataSource要在applicationContext.xml里面配置
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
...
</bean>
如果你在hibernate.cfg.xml里面配置了,就會報出Cannot unwrap to requested type [javax.sql.DataSource]錯誤。
轉載于:https://my.oschina.net/wzzz/blog/211560
總結
以上是生活随笔為你收集整理的Cannot unwrap to requested type [javax.sql.DataSource]的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 浮点型数据存储格式详解
- 下一篇: Execl常用公式