© Anghel Leonard 2020
A. LeonardSpring Boot Persistence Best Practiceshttps://doi.org/10.1007/978-1-4842-5626-8_11

11. Audit

Anghel Leonard1 
(1)
Banesti, Romania
 

Item 88: How to Track the Creation and Modification Times and Entity Users

This item explains how to add auto-generated persistent fields to track the creation and modification times and the users. Auditing is useful for maintaining history of records. This can help you track user activities.

Let’s consider the following names for these persistent fields (feel free to alter these names as you like):
  • created: The timestamp when the row was inserted in the database

  • createdBy: The current logged-in user(s) who triggered the insertion of this row

  • lastModified: The timestamp of the last update of ...

Get Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.