hibernate文档中的错误

hibenate官方文档

return new Configuration().configure().buildSessionFactory(
                    new StandardServiceRegistryBuilder().build() );

修改为:

Configuration cfg = new Configuration().configure();
                StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
                                    .applySettings(cfg.getProperties()).build();
                SessionFactory sessionFactory = cfg.buildSessionFactory(serviceRegistry);
                return sessionFactory;

你可能感兴趣的:(hibernate文档中的错误)