Mutlitenant RevisionEntity / Envers Metadata Customisation


I’ve setup a multi tenant revisions using id and tenant id as PK for the revisions table. When setting up the RevisionEntity, envers / hibernate will fail with

Caused by: org.hibernate.MappingException: Foreign key (FK8vb2v4n8wkduum583ee3hvfix:my_entity_aud [rev])) must have same number of columns as the referenced primary key (revisions [rev,tenant_id])
	at app//org.hibernate.mapping.ForeignKey.alignColumns(
	at app//org.hibernate.mapping.ForeignKey.alignColumns(

So it seems that envers does revision entity does not support multiple IDs.

Is there a way to change the envers entity metadata prior to hibernate initialising it, so that the additional fkey columns can be added?

Please try to create a reproducer with our test case template (hibernate-test-case-templates/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ at main · hibernate/hibernate-test-case-templates · GitHub) and if you are able to reproduce the issue, create a bug ticket in our issue tracker( and attach that reproducer.