Skip to content

Commit

Permalink
doc: mention the validation requirement for auto-timestamps (#2853)
Browse files Browse the repository at this point in the history
  • Loading branch information
timyates authored Apr 2, 2024
1 parent 9e2d1a2 commit cd165f1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/docs/guide/shared/dataUpdates/timestamps.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@ You can annotate a property that is a date type of entity with ann:data.annotati
You can also annotate a property that is a date type of entity with ann:data.annotation.DateUpdated[] which will be automatically populated whenever the entity is updated either via the `persist` method or when using one of the batch update methods of Micronaut Data.

NOTE: If you update the entity with an external SQL statement or custom logic you will need to update the underlying `DateUpdated` column manually.

=== JPA Hibernate and Entity Timestamps

The ann:data.annotation.DateCreated[] and ann:data.annotation.DateUpdated[] annotations require a `ValidatorFactory` bean to be present in the application context when used with JPA Hibernate.
This can be provided by ensuring one of

dependency::io.micronaut.validation:micronaut-validation[]

or

dependency::io.micronaut.beanvalidation:micronaut-hibernate-validator[]

is added to your project.

0 comments on commit cd165f1

Please sign in to comment.