Skip to content
Advertisement

Lombok @Builder How create a field with timestamp of value change?

I have the following class:

JavaScript

Is there any way to add a timestamp for when the class is initialized and when the value is changed/edited/updated?

I have attempted adding:

JavaScript

But does not seem to be what I am looking for.

Advertisement

Answer

You could achieve it with a few options. However, Lombok could not help you will it. You have to use other options.

You could use @CreationTimestamp & @UpdateTimestamp:

JavaScript

Another way is to use @PrePersist & @PreUpdate:

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