开发者

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 ve开发者_开发百科rsion. 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. e.g. 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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜