I am using hibernate envers.
Out of historical reasons I cannot use the primary key column of a referenced Table for for connecting 2 entities. For this i used the @JoinColumn functionality and a foreign key in my @ManyToOne relation to map it to another unique key field. This works fine for my dialog. However. In the audit table still the primary key is being used as reference. This is a big problem for me since i am working on existing customer data that should not be “migrated”. Is there a solution for my problem?
Please share the mapping and Hibernate version that you are using. AFAIK Envers should audit the join columns that you specify for an association.
The Version is 5.4.33
> @ManyToOne(optional = false)
> @JoinColumn(name = "uomtype", referencedColumnName = "uomtypeid")
> private UnitOfMeasurementType uomType;
There’s a foreign key reference between uomtype and uomtypeid in the other table. However the audittrail does not get that hint
Have you tried updating to 5.6 already? If it also doesn’t work with 5.6, this is probably a bug and you should create a JIRA issue for it with a reproducer.