慕容7724642
2017-07-18 15:50
org.hibernate.service.ServiceRegistryBuilder cannot be cast to org.hibernate.service.ServiceRegistry 这个是为什么啊??
5版本导入更换为:
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
在4版本中
Configuration conf = new Configuration().configure();
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(conf.getProperties()).buildServiceRegistry();
SessionFactory sf = conf.buildSessionFactory(serviceRegistry);
在5版本的Hibernate中,buildServiceReguistry()方法被替换了,用如下方法:
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(conf.getProperties()).build();
Hibernate初探之单表映射
74810 学习 · 793 问题
相似问题
回答 2
回答 1