hibernate4.0 中buildSessionFactory()新方式解惑 - 小刀

http://miniknife.iteye.com/blog/1260693


private static SessionFactory sessionFactory;
private static ServiceRegistry serviceRegistry;

private static SessionFactory configureSessionFactory() throws HibernateException {
    Configuration configuration = new Configuration();
    configuration.configure();
    serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();        
    sessionFactory = configuration.buildSessionFactory(serviceRegistry);
    return sessionFactory;
}


测试通过

你可能感兴趣的:(hibernate4.0 中buildSessionFactory()新方式解惑 - 小刀)