package com.db; import java.io.IOException; import java.io.Reader; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; public class ConnectionFactory { private static SqlSessionFactory factory; static { try { Reader reader = Resources.getResourceAsReader("sqlMapConfig.xml"); factory = new SqlSessionFactoryBuilder().build(reader, "game"); } catch (IOException e) { e.printStackTrace(); } } public static SqlSession getSession() { return factory.openSession(); } public static <T> T getMapper(Class mapper) { SqlSession session = getSession(); return (T) session.getMapper(mapper); } }

李亮 LV19
2023年3月6日
feng正经 LV3
2020年6月7日
1358849392 LV21
2019年11月13日
657588854 LV8
2019年7月25日
wwwdawn LV14
2018年11月24日
nanjing2017 LV15
2017年9月18日
987098468 LV2
2017年7月21日
慕容小九九 LV2
2017年5月3日
liuxuming LV18
2017年2月1日
tanshiming LV18
2017年1月10日