第一种:(过时的)
Configuraction cf = new Configuraction.configure();
SessionFactroy sessionFactroy = cf.buildSessionFactory();
第二种:(在4.3版本 ServiceRegistryBuilder 类过时)
ServiceRegistroy sr = new ServiceRegistryBuilder()
.applySettings(cf.getProperties())
.buildServiceRegistry();
SessionFactroy sessionFactroy = cf.buildSessionFactroy(sr);
第三种:(使用StandardServiceRegistryBuilder 替代了ServiceRegistryBuilder )
ServiceRegistroy sr = newStandardServiceRegistryBuilder ()
.applySettings(cf.getProperties())
.build();
SessionFactroy sessionFactroy = cf.buildSessionFactroy(sr);