title: Use Envers in OSGi
body: <p>I have a somewhat working instance of Hibernate embedded into my OSGi context. Now I want to have Envers, too.</p>
  
  <p>The <a href="https://docs.jboss.org/hibernate/orm/4.3/devguide/en-US/html/ch17.html#d5e5048" rel="nofollow noreferrer">documentation</a> states:</p>
  
  <blockquote>
    <p>As of ORM 4.2, Envers is fully supported. </p>
  </blockquote>
  
  <p>So it is possible. I'm just not sure how. I dutifully added <code>@Audited</code> to one of my entities, but nothing happened.</p>
  
  <p>I tried to add these listeners to my <em>persistence.xml</em>:</p>
  
  <pre><code> &lt;property name="hibernate.ejb.event.post-insert" value="org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener" /&gt;
   &lt;property name="hibernate.ejb.event.post-update" value="org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener" /&gt;
   &lt;property name="hibernate.ejb.event.post-delete" value="org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener" /&gt;
   &lt;property name="hibernate.ejb.event.pre-collection-update" value="org.hibernate.envers.event.AuditEventListener" /&gt;
   &lt;property name="hibernate.ejb.event.pre-collection-remove" value="org.hibernate.envers.event.AuditEventListener" /&gt;
   &lt;property name="hibernate.ejb.event.post-collection-recreate" value="org.hibernate.envers.event.AuditEventListener" /&gt;
  </code></pre>
  
  <p>It does not work because the listener classes don't exist anymore (I'm using Hibernate 5.1).</p>
  
  <p>Other than that, there is no much documentation. </p>
  
  <p>How do I enable Envers in OSGi?</p>
  
  <p><em>(PS. We are not going to use Eclipse Gemini or Apache Aries, because we evaluated them and they did not work for our use cases.)</em> </p>