Wildfly 10 中的 Hibernate 4.3 支持

yog*_*gas 4 hibernate wildfly

是 hibernate 4,wildfly 10 支持,我发现支持 iternet 版本 5,但没有任何重新调整版本 4。

这是我在wildfly 10上部署代码时遇到的异常。

发现以元素“create”开头的无效内容。'{" http://www.hibernate.org/xsd/orm/hbm ":drop}' 之一是预期的。

如何解决这个异常?

Sri*_*ram 5

在 Wildfly 10 中,hibernate 版本升级到 5.x。因此,默认的持久性提供程序是 hibernate 5.x。

然而,wildfly 10 并没有完全放弃对 hibernate 4 的支持。有两种方法可以让它工作。

1) 每个部署打包

  • 打包部署存档中的所有 hibernate 4.x jar 文件,并在 persistence.xml 中将“jboss.as.jpa.providerModule”属性设置为“application”

参考:https : //docs.jboss.org/author/display/WFLY10/JPA+Reference+Guide#JPAReferenceGuide-PackagingtheHibernateJPApersistenceproviderwithyourapplication

2) Wildfly 全局模块(适用于所有部署)

  • 将 hibernate 4.3 jar 文件添加到 wildfly hibernate 模块并将“jboss.as.jpa.providerModule”属性添加到“4.x”(根据 hibernate 的 module.xml 的特定版本)在您的persistence.xml

参考:https : //docs.jboss.org/author/display/WFLY9/JPA+Reference+Guide#JPAReferenceGuide-SharingtheHibernate3.5orgreaterJPApersistenceproviderbetweenmultipleapplications

仅供参考,wildfly 10 中完全删除了 hibernate 3.x 支持。