SqlSessionFactoryUtil
private static final String RESOURCE="config.xml";
private static final SqlSessionFactory factory;
static {
InputStream inputStream=null;
try {
inputStream=Resources.getResourceAsStream(RESOURCE);
} catch (IOException e) {
e.printStackTrace();
}
factory=new SqlSessionFactoryBuilder().build(inputStream);
}
public static SqlSessionFactory getSessionFactory(){
return factory;
}
public static SqlSession getSession(boolean commit){
return factory.openSession(commit);
}