It is sometimes a desired practice to place the Envers audit tables in a separate schema from the Hibernate entity model tables. Such a setup can be easily realized by either providing the default_catalog_name or the default_schema_name configuration property for Envers. The problem is when the user decides to eliminate the default tables for the audit table prefix and/or suffix to force the Enver's schema table names to be identical to those in the main ORM schema. Doing so causes a DuplicateMappingException to occur. The work around solution to have the same table names in both schemas but differing entity registrations with ORM is a bit tedious and requires that the default prefix / suffix logic continue to be used (e.g. appending _AUD as a suffix), but then explicitly setting the audit table names on the entities using @AuditTable annotation. It would be better if we could streamline this configuration so that we avoid the exception and simultaneously avoid having to be as explicit with the @AuditTable usage. |