Hibernate envers not detecting add/remove operations within an association

Hello,
I’m using Hibernate 5.1.17 as ORM and Hibernate-envers to implement the audit layer.
I have encountered a blocking issue for many days that prevent me to progress.
Hibernate-envers is unable to detect changes in collection(add/remove elements from/to Set) which is equivalent to an association table in the database entiteled ACTIVITIES_RELATIONS.

Here are my classes:

class Activity{
....
@Id
private Long id;

@ManytoMany
private Set<Relation> relations;
}

//getters and setters
public class Relation {

@Id
private Long id;

//getters and setters + other attributes
}

When I checked the database I found that the audit table is well created and every modification in the association is tracked (knowing that Relation objects are not created in the same transaction in which the Activity was created) . However, I’m always getting empty Relation Set when I’m trying to get the modifications at specific revision number.

Finally that’s how I’m fetching modifcations of Activity object:

Activity activity = auditReader.find(Activity.class, 6l, 58);

Many Thanks,

Did you try updating to the latest Hibernate version yet? Chances are, you might be running into a bug that has already been fixed. Please report back if the latest version works and also what SQL queries are executed.