I have two tables (File and Tag) with a bidirection Many-to-Many relationship, with Tag.Files set as Inverse, and both tables and the relation enabled for auditing. If I add a Tag to a File and then save it, it works. But if I add another Tag to that File and save it, I get the error:
Stepping through the code, I see that when the second Tag is added, generateBidirectionalCollectionChangeWorkUnits receives a workUnit with three collection changes. The first two have a changedElement type of ITag, but the third has a changedElement type of NHibernate.Collection.Generic.PersistentIdentifierBag<ITag>.SnapshotElement, which SessionImpl.BestGuessEntityName can't parse.
Should that third collection change item be present?
I've tested this with Envers 2.0 and 2.1 with (our local version of) NHibernate 4.0.