简体   繁体   中英

Hibernate version?

I'm using JBoss Embedded version beta3.SP10 and I'm facing a persistence bug that is should be fixed in some Hibernate version. Sadly, I don't know what version of Hibernate is used in my JBoss Embedded and couldn't find a way to find this information, the hibernate-all.jar bundled in it doesn't contain a org.hibernate.Version class, nor a MANIFEST.

How can I find the currently loaded Hibernate version without using org.hibernate.Version ?

Try this,

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

found here

Another way to obtain the version.

System.out.println(org.hibernate.cfg.Environment.VERSION)

This is for older version of Hibernate. eg 3.3.1.GA

This simple Java code is get the Hibernate version.

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();
    }
}
}

Output: Hibernate Version: 3.1.0.GA

I prefer the way of @Shell, not that of @pudaykiran. Actually, I found these two way get different input in my case. As said @pudaykiran, I got:

3.2.0 Final

And as @Shell said:

3.5.4 Final

I guess the 3.5.4 final version used org.hibernate.annotations.common of previous version. Correct me if I am wrong.

Indeed, it seems hard to find what exact versions of Hibernate modules are used. Some suggestions:

  1. Check if your Hibernate JAR has a META-INF/MANIFEST.MF with the version in it. It looks like the JBoss folks were using Ant at this time and the Manifest doesn't provide the version.

  2. Dig the JBoss Embedded SVN to find out what they're doing exactly.

  3. Try with JBoss embedded beta3.SP12 (that you can get from the Maven repository).

  4. Try to replace the hibernate-all with a bundle containing Hibernate EM 3.4.0.GA.

I would give options 3 and 4 a try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM