INFO: HHH000041: Configured SessionFactory: null怎么做呀
INFO: HHH000041: Configured SessionFactory: null
INFO: HHH000041: Configured SessionFactory: null
2016-07-10
public class HibernateUtil {
private static SessionFactory sessionFactory = null;
static {
sessionFactory = new Configuration().configure().buildSessionFactory();
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
public static Session getSession() {
return sessionFactory.openSession();
}
public static Session getSession(boolean flag) {
return flag ? sessionFactory.openSession() : sessionFactory
.getCurrentSession();
}
}
在应用类调用
private static SessionFactory sessionFactory = HibernateUtil
.getSessionFactory();
举报