Coffee with Thorben 2020-02-05 – Auditing with Hibernate Envers
Take your skills to the next level!
The Persistence Hub is the place to be for every Java developer. It gives you access to all my premium video courses, monthly Java Persistence News, monthly coding problems, and regular expert sessions.
Auditing with Hibernate Envers
In today’s stream, we will talk about another often requested topic: Writing and managing an audit log with Hibernate Envers.
I will show you how to set up Hibernate Envers for your project and how you can use its query APIs to extract information from your log. This can be useful to travel back in time to analyze which data your algorithms used during a previous run or to find out when specific information was changed. I will also show you how you can add custom information to your audit and use it in your queries.
In addition to the stream, you might find this article useful:
- Hibernate Envers – Getting started
- Hibernate Envers – Query data from your audit log
- Hibernate Envers – Extend the standard revision
- Hibernate Envers – How to Implement Conditional Auditing
Live Online Workshops
If you enjoyed the live stream, you will love my live online workshops. Find out more at thorben-janssen.com/workshops.
Question of the Week
As I explained in great details in previous posts, DTOs are the most efficient projection for read-only operations. But that’s only the case, if you use a constructor expression or Hibernate’s ResultTransformer to instantiate a DTO object for each result set record. This introduces some limitations when selecting complex data structures:
Select only specific columns from joined tables (Many-to-Many) in Spring Data JPA.
This week’s tutorials
Blog
Searching for the required configuration settings to connect Hibernate to a specific relational database is one of the most annoying parts of setting up a new persistence layer. To make that a little easier, I collected and explained the required configuration settings for the 13 most commonly used databases in this week’s post: JDBC Connection and Dialect Configuration in Hibernate.
YouTube
Hibernate’s ResultTransformers provide a very flexible way to map your query results. They were very popular in Hibernate 4 but got deprecated in Hibernate 5. That caused a lot of confusion among most Hibernate users. With Hibernate 6, we will get them back with an improved and simpler API.
In this week’s video, I tell you all you need to know about this powerful feature and why you shouldn’t be the deprecation warnings in Hibernate 5: