Hibernate + spring version compatibility

You can check this out in the spring-orm Maven POM.

For example to check the version of Hibernate used by Spring 3.2.3.RELEASE, you can issue the following shell command:

grep -A 1 hibernate- ~/.m2/repository/org/springframework/spring-orm/3.2.3.RELEASE/spring-orm-3.2.3.RELEASE.pom

The command above would result in the following output:

      <artifactId>hibernate-annotations</artifactId>
      <version>3.4.0.GA</version>
--
      <artifactId>hibernate-core</artifactId>
      <version>4.1.9.Final</version>
--
      <artifactId>hibernate-core</artifactId>
      <version>3.3.2.GA</version>
--
      <artifactId>hibernate-entitymanager</artifactId>
      <version>4.1.9.Final</version>
--
      <artifactId>hibernate-entitymanager</artifactId>
      <version>3.4.0.GA</version>

And from the output above we can deduce that Spring 3.2.3.RELEASE supports Hibernate 4.1.9.Final and 3.3.2.GA .

Of course you can try to use Spring with different version of Hibernate, but the versions from the POM are the less likely to give you some issues.


If you can't execute the grep command in windows.. navigate to your .m2\repository\org\springframework\spring-orm\4.2.5.RELEASE\spring-orm-4.2.5.RELEASE.pom file location. Open pom file in an editor and search for the word "hibernate" you can find the dependencies for your spring version. [grep command also uses same approach]


In your Eclipse IDE this can be found out quite easily.

  • Open the pom.xml in default editor in IDE.
  • Now navigate to specific dependency where spring-orm is defined.
  • If you hover over the definition and perform a CTRL + LEFT_MOUSE_CLICK it will open the spring-orm pom xml.
  • Here you can find the dependency version used for hibernate-entitymanager.

See this animation:

enter image description here