简体   繁体   中英

Hibernate Java 8 time types support in multi-module project

I am using java.time.Instant with Hibernate 5.1.0.Final . It is serialised the proper way in underlaying database when I do not use @Temporal and include dependency:

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-java8</artifactId>
        <version>${hibernate.version}</version>
    </dependency>

However, when I include this module as a dependency to another one is serialized as BLOB.

I beleive the cause may be that both of modules have spring-boot-starter-parent as parent, because they are actually seprate projects (not child-parent to each other). Any idea?

Spring Boot overrides properties defined in included modules. This happens even when the properties are not defined explicitly . Since Spring Boot 1.3.3 uses Hibernate 4.3.11.Final by default, this version is applied to the whole project.

Thus, the solution is to set hibernate.version to 5.1.0.Final in the including pom.xml .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM