是的,已弃用。将你的SessionFactory替换为以下内容:
在Hibernate 4.0、4.1、4.2中
private static SessionFactory sessionFactory;private static ServiceRegistry serviceRegistry;public static SessionFactory createSessionFactory() { Configuration configuration = new Configuration(); configuration.configure(); ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings( configuration.getProperties()). buildServiceRegistry(); sessionFactory = configuration.buildSessionFactory(serviceRegistry); return sessionFactory;}
更新:
在Hibernate 4.3中,不推荐使用 ServiceRegistryBuilder 。请改用以下内容。
serviceRegistry = new StandardServiceRegistryBuilder().applySettings( configuration.getProperties()).build();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)