I am using spring-boot with spring-data-neo4j-rest. Maven dependencies are as
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j-rest</artifactId>
<version>3.4.0.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.5.2</version>
</dependency>
</dependencies>
My model has a field of type LocalDateTime
@NodeEntity
@JsonIgnoreProperties(ignoreUnknown = true)
public class MyModel {
@GraphId
private Long id;
private LocalDateTime datetime = LocalDateTime.now();
private Date date = new Date();
...getter/setter
}
In service class this model is saved with Neo4jTemplate save method.
@Autowired
Neo4jTemplate template;
public T create(T t) {
T t1 = template.save(t);
return t1;
}
The issue is while Date field is stored in Neo4j as timestamp, LocalDateTime is not stored at all. Not getting what am I doing wrong here. Is this required to add custom converter for LocalDateTime to long conversion and register as mentioned in LocalDateTime is not converted to String but to Json object