Mario B
Mario B

Reputation: 2337

most compatible hibernate version for spring 3.2.6

i use something like this at the moment: JSF2(PrimeFaces)+Spring&Spring-Security+JPA2(Hibernate). I just love it! But somehow i was always wondering: What are recommended (or maybe "best compatible") versions of specific Spring-versions with Hibernate? Let's take Spring 3.2.6 as an example:

If i take a look of spring-orm POM it seems like it uses hibernate-entitymanager 4.1.9.Final. Should i use that one, or maybe the newest 4.1.x version? Or should i use hibernate 4.2.x? Or even 4.3.x? In my (simple) tests any of that worked just fine, but then i read here https://jira.springsource.org/browse/SPR-11240 that hibernate 4.3 is not even supported until spring 4.

So to sum it up: Which hibernate version should i use with spring 3.2.6.RELEASE and what is the best place to find information like that (for the future).

Upvotes: 2

Views: 6209

Answers (1)

Angular University
Angular University

Reputation: 43087

The best way to be sure is to check the pom of the project for optional dependencies.

In this case, we can go to the maven repository and search for the project pom:

$HOME/.m2/repository/org/springframework/spring-orm/3.2.6.RELEASE

-rw-r--r--  ... spring-orm-3.2.6.RELEASE.pom

Opening the spring-orm pom, there is an optional dependency for Hibernate:

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-core</artifactId>
  <version>4.1.9.Final</version>
  <scope>compile</scope>
  <optional>true</optional>
</dependency>

An optional dependency can be seen as "excluded by default", and it's up to the project using spring-orm if they want to use that version or some other. It's a way for project developers to document the recommended versions for certain dependencies that they don't necessarily want to enforce in depending projects.

The optional dependency is the recommended version, other versions might or might not work but that version is the most tested.

Upvotes: 9

Related Questions