'Initialize some "past" data for Hibernate Envers

My WebApp displays some data to the user which is loaded from my Spring-Boot backend. The user has the ability to select a past date and view the state of the data at that date. To provide this functionality I use Hibernate Envers.

Now, I wish to generate some initial "past" data and then simulate some changes to the data to showcase the auditing functionality of my WebApp. Both creation and changes to the data should then be reflected in the Hibernate Envers audit tables with a corresponding timestamp that is in the past.

At the moment, I am using an ApplicationRunner Bean to generate initial data (as opposed to running an SQL script) but only for current data. Ideally, I would like to take a similar approach for generating my past data.

How can I achieve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source