[hibernate-commits] Hibernate SVN: r20217 - core/trunk/documentation/envers/src/main/docbook/en-US/content.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Sun Aug 22 06:28:51 EDT 2010
Author: adamw
Date: 2010-08-22 06:28:50 -0400 (Sun, 22 Aug 2010)
New Revision: 20217
Modified:
core/trunk/documentation/envers/src/main/docbook/en-US/content/quickstart.xml
Log:
HHH-5197:
quickstart covers also direct Hibernate usage
Modified: core/trunk/documentation/envers/src/main/docbook/en-US/content/quickstart.xml
===================================================================
--- core/trunk/documentation/envers/src/main/docbook/en-US/content/quickstart.xml 2010-08-22 10:15:05 UTC (rev 20216)
+++ core/trunk/documentation/envers/src/main/docbook/en-US/content/quickstart.xml 2010-08-22 10:28:50 UTC (rev 20217)
@@ -32,8 +32,7 @@
<title>Quickstart</title>
<para>
- When configuring your Hibernate (<literal>persistence.xml</literal> if you are using JPA,
- <literal>hibernate.cfg.xml</literal> or other if you are using Hibernate directly), add the following event
+ If you're using JPA, when coniguring Hibernate (in <literal>persistence.xml</literal>), add the following event
listeners: (this will allow Envers to check if any audited entities were modified)
</para>
@@ -60,6 +59,24 @@
</persistence-unit></programlisting>
<para>
+ If you're using Hibernate directly, add the following to <literal>hibernate.cfg.xml</literal>:
+ </para>
+ <programlisting>
+ <hibernate-configuration>
+ <session-factory>
+
+ <listener class="org.hibernate.envers.event.AuditEventListener" type="post-insert"/>
+ <listener class="org.hibernate.envers.event.AuditEventListener" type="post-update"/>
+ <listener class="org.hibernate.envers.event.AuditEventListener" type="post-delete"/>
+ <listener class="org.hibernate.envers.event.AuditEventListener" type="pre-collection-update"/>
+ <listener class="org.hibernate.envers.event.AuditEventListener" type="pre-collection-remove"/>
+ <listener class="org.hibernate.envers.event.AuditEventListener" type="post-collection-recreate"/>
+
+
+ </session-factory>
+ </hibernate-configuration>
+ </programlisting>
+ <para>
The <literal>EJB3Post...EvenListener</literal>s are needed, so that ejb3 entity lifecycle callback
methods work (<literal>@PostPersist, @PostUpdate, @PostRemove</literal>.
</para>
@@ -155,3 +172,4 @@
</para>
</chapter>
+
More information about the hibernate-commits
mailing list