Reputation: 41
I'm trying to audit a collection of @Embeddable objects using hibernate-envers.
According to https://hibernate.atlassian.net/browse/HHH-6613 support for auditing @ElementCollection was added. This feature doesn't seem to work well: when trying to save several @Embeddable objects with the same revision number NonUniqueObjectException is thrown.
Does anyone have a working example of @ElementCollection+@Embeddable audited with Envers?
Upvotes: 4
Views: 3287
Reputation: 21
As of Hibernate 5.2.8, we managed to make it work by these steps:
Set
for the collection of embeddable elementshashCode()
and equals()
methods in the class of the embeddable elementsSETORDINAL
in the table that holds
the audit log of said elements (or let hibernate create the tables for you
by setting the appropriate configuration key). Upvotes: 2