在创建Configuration对象之后:Configuration cfg = new Configuration().configure();
要通过Configuration创建SessionFactory对象:
1. SessionFactory sf = cfg.buildSessionFactory(); // 是Hibernate3.X时的写法
2. ServiceRegistry sr = new ServiceRegistryBuilder().applySettings(cfg.getProperties()).buildServiceRegistry();是Hibernate4.3 ~ Hibernate4.0时的
3. ServiceRegistry sr = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()).build();
SessionFactory sf = cfg.buildSessionFactory(sr); // Hibernate4.3时的