
sqlsession的创建及其使用的模板
代码,复制直接使用
public void test1() throws IOException {
InputStream inputStream = Resources.getResourceAsStream("mybatis-config.xml");
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
// DDL方法.重要
Usermapper mapper = sqlSession.getMapper(Usermapper.class);
List all=mapper.findAll();
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)