问答详情
源自:1-11 通过Hibernate API编写访问数据库的代码

照着老师代码打的结果出现Type mismatch: cannot convert from ServiceRegistryBuilder to ServiceRegistry错误

为什么我这段代码ServiceRegistry sr = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();提示线面的错误

Type mismatch: cannot convert from ServiceRegistryBuilder to ServiceRegistry



提问者:念桥 2016-10-13 16:24

个回答

  • qq_没什么_1
    2016-10-14 11:00:05

    你这个是导入的包不对

    import org.hibernate.service.ServiceRegistryBuilder;


    import org.hibernate.service.ServiceRegistry;

    导入这两个包就行了