private static SessionFactory buildSessionFactory() {
// TODO Auto-generated method stub
try {
Configuration cfg = new Configuration();
cfg.configure();
ServiceRegistry sr = new ServiceRegistryBuilder().applySettings(
cfg.getProperties()).buildServiceRegistry();
return cfg.buildSessionFactory(sr);
} catch (Exception e) {
}
return null;
}
public static SessionFactory getSessionFacotry() {
return sessionFacotry;
}
1 回答
已采纳
Lookiy
TA贡献4条经验 获得超3个赞
SessionFactory factory = new Configuration().configure().buildSessionFactory();
可能方法调错了
添加回答
举报
0/150
提交
取消