Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Spring boot with older version of hibernate

I am creating a fresh new project using spring boot 1.5, with a dependent entity module ( Created way back in 2012 ).

Entity module is using older version of hibernate ( 3.3.2 ), I can't modify entity module.

Entity module is using following annotation which is removed with Hibernate5 ( comes default by spring boot 1.5 )

CollectionOfElements
MapKey
@ForeignKey
@IndexColumn

I know in that we can give different version of jars can be used in spring boot, I tried by overriding but it didn't work

Any help or guide will be highly appriciated, Thanks A Lot

<!-- HIBERNATE OLDER VERSION COMPATIBILITY -->
        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-annotations -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.4.0.GA</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>3.1.0.GA</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate -->
        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.3.2.GA</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>3.3.2.GA</version>
        </dependency>
like image 351
Arvind Avatar asked Sep 15 '25 01:09

Arvind


1 Answers

You should use properties to override dependency versions, however there's no guarantee that a given version of Spring Boot will work with older versions of one of its dependencies.

Here, you can see a list of dependency version properties for Spring Boot 1.5.9:

<properties>
    <!-- Dependency versions -->
    <activemq.version>5.14.5</activemq.version>
    <antlr2.version>2.7.7</antlr2.version>
    <appengine-sdk.version>1.9.59</appengine-sdk.version>
    <artemis.version>1.5.5</artemis.version>
    <aspectj.version>1.8.13</aspectj.version>
    <assertj.version>2.6.0</assertj.version>
    <atomikos.version>3.9.3</atomikos.version>
    <bitronix.version>2.1.4</bitronix.version>
    <caffeine.version>2.3.5</caffeine.version>
    <cassandra-driver.version>3.1.4</cassandra-driver.version>
    <classmate.version>1.3.4</classmate.version>
    <commons-beanutils.version>1.9.3</commons-beanutils.version>
    <commons-collections.version>3.2.2</commons-collections.version>
    <commons-codec.version>1.10</commons-codec.version>
    ...

For Hibernate, you can use something like this to override its version:

<properties>
    <hibernate.version>3.3.2.GA</hibernate.version>
    <hibernate-validator.version>3.1.0.GA</hibernate-validator.version>
</properties>
like image 53
Behrang Avatar answered Sep 16 '25 16:09

Behrang