Posted on 2008-01-30 11:54
itVincent 閱讀(4122)
評論(5) 編輯 收藏 所屬分類:
Java基礎(chǔ)
今天一同事要在struts + spring + hibernate下使用jdbc,但發(fā)現(xiàn)在HibernateDaoSupport 的getSession.connection()已經(jīng)deprecated了,
public Connection connection() throws HibernateException;上有句說明
@deprecated
To be replaced with a SPI for performing work against the connection; scheduled for removal in 4.x
上去查了一下資料,竟然現(xiàn)在是沒有替代方法的...-0-汗
雖然使用connection()還是可以的,但是考慮到今后的變化,還是得找個代替方法.
spring中有個工具類支持了這樣一個功能,并且不是依賴connection()方法的,如下:
SessionFactoryUtils.getDataSource(getSessionFactory());