title: How to customize hibernate @ElementCollection envers audit table name?
body: <p>I'm currently using <strong>Hibernate &amp; Envers version 5.2.9.Final</strong>. I want to use <strong>@ElementCollection</strong> with a <strong>custom table name</strong> for both the <strong>collection and the audit table</strong>. </p>
  
  <p>What I know so far is that modifying default table names has a variety of annotations to work with: For the entity itself there are the annotations @Table and @SecondaryTable as well as the corresponding envers annotations @AuditTable and @SecondaryAuditTable. For changing the table name of an element collection there is the @CollectionTable annotaion. I have not been able to find a corresponding envers annotation so far. So my question is:</p>
  
  <p><strong><em>How can I change the name for a hibernate @ElementCollection envers audit table?</em></strong></p>
  
  <hr>
  
  <p><strong>Additional info</strong></p>
  
  <p>In the <a href="https://hibernate.atlassian.net/browse/HHH-6613" rel="nofollow noreferrer">hibernate envers ticket which tracks the adding of auditing support</a> for element collections, the same question was asked back in 2013 but not answered.</p>
  
  <p>A <strong>code snippet</strong> to make my setup clear:</p>
  
  <pre><code>@Entity
  @Table(name = "\"user\"")
  @SecondaryTable(name = "\"user_secondary\"")
  @Audited
  @AuditTable("\"user_audit\"")
  @SecondaryAuditTable(secondaryTableName = "user_secondary",
          secondaryAuditTableName = "\"user_secondary_audit\"")
  public class User {
  
      // ... stuff like id and other fields ...
  
      @ElementCollection
      @CollectionTable(name = "\"user_references\"")
      private Map&lt;String, Long&gt; references = new HashMap&lt;&gt;();
      // TODO FIXME how to get a custom name for the audit table?
  
      // ... more stuff like getters and setters
  }
  </code></pre>
  
  <p>Hibernate generates all tables as intended, yet the <strong>collecction audit table is named 'user_references_AUD'</strong> while <em>I would like</em> to get the name <strong>'user_references_audit'</strong> like for the other tables.</p>
  
  <p>I'm also <em>aware of the global settings affecting the audit table prefix or suffix</em>, but that is only a last resort for my use case.</p>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>As suggested I added a <a href="https://hibernate.atlassian.net/browse/HHH-11595" rel="nofollow noreferrer">feature request</a> to Hibernate JIRA.</p>