Creating a datetime native type with spring-data-neo4

You have to opt-in to enable the native type support. More details in this great blog post (section Native types support) written by @michael.simons.
The key ingredient is to add (assuming you are using bolt protocol) the native type support dependency

<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j-ogm-bolt-native-types</artifactId>
    <version>3.2.2</version>
    <scope>runtime</scope>
</dependency>

and enable it either via ogm.properties,

use-native-types=true

the Configuration definition

Configuration configuration = new Configuration.Builder()
        .uri("bolt://neo4j:password@localhost")
        .useNativeTypes()
        .build()

or if you are using Spring Boot for your application you can do this (starting from Spring Boot 2.2) via the application.properties.

spring.data.neo4j.use-native-types=true
1 Like