Working with Spring Data Envers (and Hibernate) via Spring Boot 3.2.
Spring Data Envers provides useful methods for retrieving the revisions of an entity via the RevisionRepository interface. However, they all seem to eagerly load the revisioned editions of the entity. If the entity has been changed 500 times then that is "500 editions" of that entity which is pulled from the database. That is a lot.
At first I'm only interested in the list of edition numbers (rev_id) and their associated timestamp, not the actual entity. Then, if I choose to drill-down on a particular revision, then only at that point should the actual entity be retrieved.
Is there a way to accomplish this?
I know I'll then be hitting the _aud
table twice, but for tables with many columns it doesn't make sense to create all 500 entity editions, when nobody has asked for it. For tables with only a few columns I would guess it doesn't really matter that much.
This was my bad. Hibernate indeed creates proxies for the entities of a
Revision
object. So it is in fact not really fetched from the DB until you ask for it specifically.