大學(xué)生就業(yè)培訓(xùn),高中生培訓(xùn),在職人員轉(zhuǎn)行培訓(xùn),企業(yè)團(tuán)訓(xùn)

 1 String resource = "mybatis-config.xml"; 2         InputStream inputStream = null; 3         try { 4             // 獲取SqlSessionFactory 5             inputStream = Resources.getResourceAsStream(resource); 6             SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(inputStream); 7             // 獲取SqlSession 8             SqlSession session = factory.openSession(); 9             try {10                 //method111                 //Student student = session.selectOne("cn.cgq.demo.mybatis.mapper.StudentMapper.selectStudent", 10);12                 //method213                 StudentMapper mapper=session.getMapper(StudentMapper.class);14                 Student student=mapper.selectStudent(new Long(10));15                 //輸出結(jié)果16                 System.out.print