gistfile1.txt public class Test {public static void main(String[] args) throws Exception {String resource = "mybatis.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSession
public class Test { public static void main(String[] args) throws Exception { String resource = "mybatis.xml"; InputStream inputStream = Resources.getResourceAsStream(resource); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); SqlSession session= sqlSessionFactory.openSession(); //Users info=session.selectOne("user.getUserById",230); //info.setName("说的是"); //info.setPass("241441"); //session.update("user.update",info); session.delete("user.deleteById",230); // Users info=new Users(230, "道德 ", "123"); Mapmap=new HashMap (); map.put("id", 230); map.put("name", "老子"); map.put("pass", "123456"); System.out.println(session.insert("user.add",map)); // System.out.println(session.selectOne("user.getUserById",1)); Map map1=new HashMap (); map1.put("sql", "select * from users order by id"); List list= session.selectList("user.selectBySql",map1); for (Users userInfo : list) { System.out.println(userInfo); } // List list=session.selectList("user.getUserAll"); // System.out.println(list); session.commit(); session.close(); } }