Skip to content
Advertisement

Spring Data Couchbase @CreatedDate not working

I’m using Spring boot with spring data couchbase. I’ve added two fields for createdDate and lastModifiedDate with @CreatedDate and @LastModifiedDate annotations in Movie Document.

lastModifiedDate works great but createdDate is always null.

JavaScript

I’ve also added a configuration for @EnableCouchbaseAuditing:

JavaScript

Movie Repository:

JavaScript

application.yml for reference:

JavaScript

Advertisement

Answer

As stated in the documentation, in order to distinguish between a creation and an update, spring-data-couchbase needs a @Version annotated attribute in the entity class

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement