- 应用开发
看到Mybatis源码就感到烦躁,怎么办?
时间:2010-12-5 17:23:32 作者:应用开发 来源:数据库 查看: 评论:0
内容摘要:复制publicstaticvoidmain(String[]args){ Stringresource="mybatis-config.xml"; Inp

复制publicstatic void main(String[] args) { String resource = "mybatis-config.xml"; InputStream inputStream = null; SqlSession sqlSession = null; try { inputStream = Resources.getResourceAsStream(resource); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); sqlSession = sqlSessionFactory.openSession(); Useruser = sqlSession.selectOne("com.tian.mybatis.mapper.UserMapper.selectById",怎么办
1); System.out.println(user); } catch (Exception e) { e.printStackTrace(); } finally { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } sqlSession.close(); } } 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.