I have a User class with field:
@Relationship(value = "HAS_VACATIONS", direction = OUTGOING)
private Set vacations;
In Vacations class I have some dates:
private LocalDate startDate;
private LocalDate endDate;
When I save a User, startDate and endDate are stored as java.lang.String in the graph.
I have a class Holiday with field:
private LocalDate date;
When I save a Holiday, date is stored as a java.time.LocalDate in the graph.
If I save Vacactions directly outside User, I have the same java.lang.String issue.
I there an OGM issue with mapping?
I assume that you are using an 3.2.x version of Neo4j-OGM, right? In this case you have to enable the native type conversion by adding the native-type dependency.
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-bolt-native-types</artifactId>
<version>${your-neo4j-ogm.version}</version>
</dependency>
and actively enable it in the Neo4j-OGM configuration
Configuration configuration = new Configuration.Builder()
// ...
.useNativeTypes()
.build()
The reason why this is a dedicated dependency is rooted in the missing functionality in Neo4j back in the days to handle date/time types.
More on this topic: Neo4j-OGM - Native property types
I'm using neo4j-ogm-quarkus 3.6.0 with neo4j-ogm-core 4.0.8.
For backward compatibility you still have to enable the native types for the Neo4j-OGM configuration.
This can be done via application.properties
org.neo4j.ogm.use-native-types = true
(reference: GitHub - neo4j/neo4j-ogm-quarkus: Quarkus extension to that allows proper usage of Neo4j-OGM inside Quarkus.)