Simon Ritchie wrote:Can anyone see what I'm doing incorrectly here? Any help is appreciated.
Object Relational Mapping (ORM) Data Access - Hibernate wrote:As of Spring 4.0, Spring requires Hibernate 3.6 or later. Note that the Hibernate team stopped supporting Hibernate 3 years ago and even phased out support for Hibernate 4.x in late 2015. We therefore recommend Hibernate 5.1 and higher from a 2016+ perspective.
Simon Ritchie wrote:I had initially tried to use Hibernate 5.2.1 but when I ran my main class I got an "Unsuppoerted Major/Minor Version 52" error. Some Googling suggested that this was probably the result of my Spring being a version out of sync with my Hibernate so I've decided to keep both Spring and Hibernate at 4.X for the time being.
Simon Ritchie wrote:From what I've read online this appears to be a problem with the Hibernate JPA dependency. But I've updated this dependency in my POM to the latest available version and the problem persists.
Roel De Nijs wrote:
Simon Ritchie wrote:I had initially tried to use Hibernate 5.2.1 but when I ran my main class I got an "Unsuppoerted Major/Minor Version 52" error. Some Googling suggested that this was probably the result of my Spring being a version out of sync with my Hibernate so I've decided to keep both Spring and Hibernate at 4.X for the time being.
That's related to the JDK version used to compile the (I assume) Hibernate dependencies and the Java version you use to run your program. Here you'll find an overview of the different major/minor versions. I guess one of the dependencies is compiled with JDK8 and requires (at least) JDK8 to be executed, but you are using an older JDK version.
Simon Ritchie wrote:From what I've read online this appears to be a problem with the Hibernate JPA dependency. But I've updated this dependency in my POM to the latest available version and the problem persists.
You still are using different versions among your Hibernate dependencies. Why have hibernate-core and hibernate-entitymanager a different version? In fact, you are using a bunch of Hibernate dependencies which I never have added to the pom.xml when creating a Maven project with JPA and Hibernate as persistence provider.
It seems the indexes() method was added to the @Table annotation in JPA 2.1. Although you have a dependency to get the JPA 2.1 annotations, there is probably another dependency which depends on an older version of the JPA annotations. So you ended up having both jars in the classpath as transitive dependencies.
Hope it helps!
Kind regards,
Roel
Dave Tolls wrote:Why drop back all the way to a Hibernate 3 version?
I know it currently works for you, but as Roel posted earlier it has been unsupported for quite a long time now.
Simon Ritchie wrote:I've just updated my POM to use Spring 4.3.0.RELEASE and Hibernate 5.2.1.Final.