摘录自:http://blog.csdn.net/y172158950/article/details/17006127
1. 依据resource获取Reader的sequence图
- String resource = "com/test/configuration.xml";//获得xml(Mybatis)数据库连接的连接
- Reader reader = Resources.getResourceAsReader(resource);//读取里面的文件
2. 依据Reader获取SqlSeesionFactory
- SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(reader);//创建session工厂
3. 打开SqlSeesion
- SqlSession session = sessionFactory.openSession();//打开session
4. insert数据的sequence图
- flag=session.insert("com.test.Mapper.insertGood",g);
好了,整个流程图就画完啦,helloworld就到这