Configuration cfg = new Configuration().configure();
ServiceRegistry serviceRegistry =new ServiceRegistryBuilder().applySettings(cfg.getProperties()).buildServiceRegistry();
SessionFactory sf = cfg.configure().buildSessionFactory(serviceRegistry);
//提示buildServiceRegistry()方法不存在,请问大侠这是什么情况?
//我引了Hibernate中required文件夹下的所有包
//用老式方法可以,用网上说的新方法就不行。版本是Hibernate4.3.1
------解决方案--------------------
new Configuration().configure().buildSessionFactory().getCurrentSession()4.3直接这样了
------解决方案--------------------
给你一个权威的:
new SchemaExport(new AnnotationConfiguration().configure()).create(false, true);
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();