如何升级 Hibernate 4.3 --> 5.2?

问题描述 投票:0回答:2

我用 Google 搜索了一下,但没有看到任何将 Hibernate 升级到 5.2 的教程。

我唯一能找到的是: http://hibernate.org/search/documentation/migrate/5.0/ 但它似乎特定于 Hibernate 搜索。

hibernate migration upgrade
2个回答
11
投票

完整的 Hibernate ORM 升级指南可以在这里找到:

https://github.com/hibernate/hibernate-orm/blob/5.0/migration-guide.adoc


0
投票

参考休眠文档: https://docs.jboss.org/hibernate/orm/5.0/userguide/html_single/Hibernate_User_Guide.html#bootstrap-jpa

第 3.2 节)本机引导可能会有所帮助,就像我在迁移期间的情况一样

    config = new Configuration().configure("hibernate.cfg.xml");
    config.addProperties(hibernateProperties);
    BootstrapServiceRegistry bootstrapServiceRegistry = new BootstrapServiceRegistryBuilder()
            .build();

    StandardServiceRegistryBuilder standardServiceRegistryBuilder =
            new StandardServiceRegistryBuilder(bootstrapServiceRegistry);
    standardServiceRegistryBuilder.applySettings(config.getProperties());
    StandardServiceRegistry standardServiceRegistry = standardServiceRegistryBuilder
            .configure()
            .build();


    MetadataSources metadataSources = new MetadataSources(standardServiceRegistry);
    metadataSources.addPackage(packageWithMappedClasses);
    Metadata metadata = metadataSources.buildMetadata();
    sessionFactory = metadata.buildSessionFactory();
© www.soinside.com 2019 - 2024. All rights reserved.