Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-21-2020 03:23 AM
Hi,
I'm trying to use spring-data-neo4j 5.2.4.RELEASE, and in particular the Auditing @createdDate
functionality
@NodeEntity
public class Person {
@Id
private Long idSubject;
@CreatedDate
private long dtInsert;
@LastModifiedDate
private long dtUpdate;
...
@CreatedDate
seems not to work. When the object is created the first time in the db with repository.save (obj) only dtUpdate is set.
Is it a bug or has someone managed to make it work?
Thank you!
Antonio Bruno
02-21-2020 05:57 AM
You are not using a generated id but set it by yourself. This is a known limitation in SDN because we cannot differentiate if the entity is new or just gets updated.
We documented this in the Spring Data Neo4j reference.
02-25-2020 06:00 AM
Ok thanks, I missed the note
@gerrit.meier so there is no mechanism in SDN-OGM to do in a single operation what the native cypher query does with syntax
MERGE ...
ON CREATE SET ...
ON MATCH SET ...
If I use SDN-OGM in this case, am I obliged to make a findById(obj.idSubject) first and then a save(obj)?
Sincerely
Antonio Bruno
All the sessions of the conference are now available online