public SqlSession open() {
Reader reader;
try {
reader = Resources.getResourceAsReader("SQLMapConfig.xml");
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder()
.build(reader);
sqlSession = sessionFactory.openSession();
} catch (IOException e) {
System.out.println("SQLMapConfig.xml读取失败");
e.printStackTrace();
}
return sqlSession;
}
这个是mybatis的 当然其他的也一样的道理