Java EE 8 / JSF-2.3 / Wildfly-26 项目中使用的默认 Hibernate 版本

Default version of Hibernate used in Java EE 8 / JSF-2.3 / Wildfly-26 project

如何使用这些配置在我的项目中找到默认 Hibernate 版本的确切版本:


pom.xml 文件:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>example</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </properties>
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>8.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>2.1.212</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.2</version>
            </plugin>
        </plugins>
    </build>
</project>

我也检查了这个 link 但对我没有帮助:LINK

甚至这个代码片段也有错误:

System.out.println(org.hibernate.annotations.common.Version.VERSION);

org.hibernate cannot be resolved to a variable

尝试

System.out.println(org.hibernate.Version.getVersionString());

package com.test;
public class TestBean {
public static void main(String[] args) {
    try {
        String hibernateVersion = org.hibernate.annotations.common.Version.VERSION;
        System.out.println("Hibernate Version: "+ hibernateVersion);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
}

您使用的不是 Hibernate,而是 JPA。 hibernate版本设置在WildFly pom.xml https://github.com/wildfly/wildfly/blob/26.1.0.Final/pom.xml#L418 for WildFly 26.1.0.Final