类型serviceregistrybuilder是过时的 ,改成用StandardServiceRegistryBuilder注册对象要用的jar包是哪个,有谁知道吗
StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder().configure().build(); Metadata metadata = new MetadataSources(standardRegistry).getMetadataBuilder().applyImplicitNamingStrategy(ImplicitNamingStrategyJpaCompliantImpl.INSTANCE).build();<br> sessionFactory = metadata.getSessionFactoryBuilder().build(); session = sessionFactory.openSession(); transaction = session.beginTransaction();
你应该用的是hibernate4 所以应该这样注册
谢谢,已经解决了