Had a issue which took a good while to track down.
When using AuditReader.find(Entity.clas, id, revision) to pull back a revision of a entity a SQL exception was given with a non unique column alias on entities with a many-to-many field, other entites without manytomany worked.
It looks like the query was generating a duplicate '_revision' field without using an column alias. '_revision' was set using the property overide 'org.hibernate.envers.revisionFieldName=_revision' .
Below is a copy of the failing query:
After lots of debugging trying to create test cases based on my entity relationships which where passing without problem it occurred on the test project i'd not overiden 'org.hibernate.envers.revisionFieldName' . As soon as I set this property the test cases started failing. Removing this property from the original project, aliases are generated correctly and audited entities with many to many relatioships can now be retreivied. Below is the working sql generated with 'org.hibernate.envers.revisionFieldName' not set.
Could you please post your entity mappings, Envers configuration and execution of AuditReader.find() method? I was unable to reproduce this issue. Setting "org.hibernate.envers.revisionFieldName" to "_revision" in org.hibernate.envers.test.integration.manytomany.BasicSet test case produces valid SQL query. Example:
No response received