Kawu
Kawu

Reputation: 14003

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?

Upvotes: 21

Views: 51195

Answers (5)

g5thomas
g5thomas

Reputation: 315

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

Upvotes: 10

WesternGun
WesternGun

Reputation: 12738

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.

Upvotes: 0

max3d
max3d

Reputation: 1507

Try this,

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

found here

Upvotes: 52

UdayKiran Pulipati
UdayKiran Pulipati

Reputation: 6667

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

Upvotes: 6

Pascal Thivent
Pascal Thivent

Reputation: 570385

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.

Upvotes: 0

Related Questions