将 Wildfly 15 中的 Hibernate 降级到 4.x

Downgrading Hibernate in Wildfly 15 to 4.x

我想将一个应用程序部署到需要休眠的 Wildfly 15 4.x。根据文档,这是在部署的 persistence.xml 中使用以下 属性 完成的:

<property name="jboss.as.jpa.providerModule" value="org.hibernate:4.3"/>

但在部署期间的日志中,我可以看到 Wildfly 仍在加载 Hibernate 5.3:

2019-04-02 18:29:13,922 INFO  [] [org.hibernate.Version] (ServerService Thread Pool -- 75) HHH000412: Hibernate Core {5.3.7.Final}

我还尝试向 jboss-deployment-structure.xml 文件添加依赖项,但也没有效果:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
    <dependencies>
        <module name="org.hibernate" slot="4.3"/>
    </dependencies>
</deployment>

有什么想法吗?至少当我将模块依赖项的插槽更改为明显错误的内容时,部署会在那里失败。所以似乎 jboss-deployment-structure.xml 在我的部署过程中被识别了。

您必须排除默认的休眠模块

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
  <deployment>
    <dependencies>
       <module name="org.hibernate" slot="4.3"/>
    </dependencies>
    <exclusions>
       <module name="org.hibernate"/>
    </exclusions>
  </deployment>