在 hibernate4.1.9 buildsessionfactory 方法已被弃用,所以为什么将 serviceRegistry 传递给 buildsessionFactory
问问题
97 次
1 回答
0
像这样?
public class Util {
private static SessionFactory sessionFactory;
private static ServiceRegistry serviceRegistry;
public static SessionFactory configureSessionFactory() {
Configuration configuration = new Configuration();
configuration.configure();
serviceRegistry = new ServiceRegistryBuilder().applySettings(
configuration.getProperties()).buildServiceRegistry();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
return sessionFactory;
}
}
于 2013-04-29T15:54:33.500 回答