Unable to save createdby and updatedby in spring boot 2.3.5

I am unable to save createdby and updatedby in spring boot neo4j in spring boot 2.3.5. i have annotated them with CreatedDate, CreatedBy, LastModifiedBy, LastModifiedDate and used spring data annotation of prepersist and preupdate but nothing is happening

Did you enable the auditing feature for Spring Data Neo4j?

I did enable it @EnableNeo4JAuditing. I am using these annotations to update the createdby and updatedby while with the above auditing annotation it was updating the createdAt and updatedAt but not the by ones.

Spring Data Neo4j does not support the JPA annotations for prepersist and preupdate. You would provide the username by implementing the AuditorAware interface:

class MyUserProvider implements AuditorAware<String> {

  public Optional<String> getCurrentAuditor() {
    return Optional.of("MyUserName");

This also helps to separate the logic for auditing and user resolution from your domain model.

See Spring Data Neo4j - Reference Documentation for more information.

1 Like

Thanks @gerrit_meier it helped me more to be switching to neo4j.