Home > Enterprise >  How to ensure hibernate dependencies are compatible without SpringBoot
How to ensure hibernate dependencies are compatible without SpringBoot

Time:03-29

I have the following hibernate dependencies

  • hibernate-core 5.4.3-Final
  • hibernate-ehcache 5.4.3-Final
  • hibernate-entitymanager 5.4.3-Final
  • hibernate-jpamodelgen 5.4.3-Final
  • hibernate-validator 5.4.3-Final
  • hibernate-hikaricp 5.4.3-Final

I am experiencing this bug which is in 5.4.3-Final https://hibernate.atlassian.net/browse/HHH-13259, and it is fixed in 5.4.5-Final.

However, there is no 5.4.5-Final version for hibernate-hikaricp & hibernate-validator.

If I use the dependencies below with the versions as shown below how can I be certain that there aren't any incompatibilities?

  • hibernate-core 5.4.5-Final
  • hibernate-ehcache 5.4.5-Final
  • hibernate-entitymanager 5.4.5-Final
  • hibernate-jpamodelgen 5.4.5-Final
  • hibernate-validator 5.4.3-Final
  • hibernate-hikaricp 5.4.3-Final

I do not have SpringBoot, however could I find out if there is a SpringBoot approved constellation with 5.4.5-Final?

CodePudding user response:

The version scheme follow https://semver.org, and according to that specifications changes to the last digit (patch) should not affect the API of the package, therefore these packages should be compatible.

CodePudding user response:

The following artifacts are all part of Hibernate ORM:

hibernate-core
hibernate-ehcache
hibernate-entitymanager
hibernate-jpamodelgen
hibernate-hikaricp

Since they are part of the same project, they should obviously use the exact same version: 5.4.5.Final in your case, I suppose, though upgrading to the latest 5.6 would be a good idea.

This one, however, is a different project, Hibernate Validator:

hibernate-validator

As stated on the Hibernate website, Hibernate projects are not part of a release train. The compatible versions of Hibernate ORM and Hibernate Validator will not necessarily be identical. For example, Hibernate ORM 5.6 will generally be used with Hibernate Validator 6.2.

There are no direct dependencies between HV and Hibernate Validator, though; they interact with each other through the Java EE / Jakarta EE standard. So bear with me, it's going to be a bit complex.

In your case, when using Hibernate ORM 5.4, you are using JPA 2.2, wich is part of Java EE 8. You can find that information on the Hibernate ORM compatibility matrix.

If you look at the Hibernate Validator compatibility matrix, you will see that both Hibernate Validator 6.0 and 6.2 are compatible with Java EE 8. other versions of Hibernate Validator may be as well, but only those two are still maintained, so you should pick one of those.

If you need to know what's the latest micro for 6.2 (6.2.x), you can find a list here.

All that to say: just use the latest version of Hibernate Validator that is compatible with the Java EE / Jakarta EE version you're using. In you're case it's Java EE 8, so use Hibernate Validator 6.2.

  • Related