# Mutlitenant RevisionEntity / Envers Metadata Customisation

**URL:** <https://discourse.hibernate.org/t/mutlitenant-revisionentity-envers-metadata-customisation/8871>\
**Category:** Hibernate ORM\
**Created:** [January 19, 2024, 9:47am UTC](https://discourse.hibernate.org/t/mutlitenant-revisionentity-envers-metadata-customisation/8871 "2024-01-19T09:47:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsamartins](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/bsamartins/32/2939_2.png) [@bsamartins](https://discourse.hibernate.org/u/bsamartins)\
**Post date:** [January 19, 2024, 9:47am UTC](https://discourse.hibernate.org/t/mutlitenant-revisionentity-envers-metadata-customisation/8871/1 "2024-01-19T09:47:53Z")

</div>

Hi

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

```auto
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(ForeignKey.java:138)
	at app//org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:119)

```

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?

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [January 22, 2024, 2:50pm UTC](https://discourse.hibernate.org/t/mutlitenant-revisionentity-envers-metadata-customisation/8871/2 "2024-01-22T14:50:19Z")

</div>

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/JPAUnitTestCase.java at main · hibernate/hibernate-test-case-templates · GitHub](https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java)) and if you are able to reproduce the issue, create a bug ticket in our issue tracker([https://hibernate.atlassian.net](https://hibernate.atlassian.net)) and attach that reproducer.
