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);

  }

posted @ 2018-10-17 19:35  公々子  阅读(533)  评论(0编辑  收藏  举报
Document