課程
/后端開發(fā)
/Java
/通過自動回復(fù)機(jī)器人學(xué)Mybatis---基礎(chǔ)版
求大神幫幫忙
2017-06-26
源自:通過自動回復(fù)機(jī)器人學(xué)Mybatis---基礎(chǔ)版 3-1
正在回答
public?SqlSession?getSqlSession()?throws?IOException?{ //?STEP-1?通過配置文件獲取數(shù)據(jù)庫連接的相關(guān)信息 Reader?reader?=?Resources.getResourceAsReader("com/imooc/config/Configuration.xml"); //?STEP-2?通過配置信息構(gòu)建一個SqlSessionFactory SqlSessionFactory?sqlSessionFactory?=?new?SqlSessionFactoryBuilder().build(reader); //?STEP-3?通過SqlSessionFactory打開數(shù)據(jù)庫會話 SqlSession?sqlSession?=?sqlSessionFactory.openSession(); return?sqlSession; }
SqlSessionFactory 里面沒有 openSession() 這個靜態(tài)方法,
需要先創(chuàng)建?SqlSessionFactory 類的對象才能調(diào)用??openSession()?
舉報
微信公眾號自動回復(fù)功能學(xué)習(xí)Mybatis,基礎(chǔ)教程加案例實戰(zhàn)方式學(xué)習(xí)
1 回答按照老師的代碼打的出現(xiàn)了HTTP Status500錯誤
2 回答這是什么錯誤
2 回答確定和老師的代碼一樣,但是報錯
1 回答代碼一樣,我的報錯
4 回答classNotFound錯誤
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2017-06-30
SqlSessionFactory 里面沒有 openSession() 這個靜態(tài)方法,
需要先創(chuàng)建?SqlSessionFactory 類的對象才能調(diào)用??openSession()?