HHH-5197:
quickstart covers also direct Hibernate usage git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@20217 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
4ed4f1f419
commit
1065aa72a7
|
@ -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>
|
||||
|
||||
|
@ -59,6 +58,24 @@
|
|||
</properties>
|
||||
</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>.
|
||||
|
@ -155,3 +172,4 @@ Person oldPerson = reader.find(Person.class, personId, revision)
|
|||
</para>
|
||||
</chapter>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue