From a542ff1827950ef1ab05af9f6b7a2c71e6fd2c13 Mon Sep 17 00:00:00 2001 From: Wim Deblauwe Date: Wed, 20 Jan 2016 16:25:28 +0100 Subject: [PATCH] DATAJPA-850 - Added documentation on how to use the @EntityListeners annotation to enable auditing. Added instructions to the reference documentation on how to register the AuditingEntityListener using JPA's @EntityListeners annotation. Original pull request: #163. --- src/main/asciidoc/jpa.adoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/asciidoc/jpa.adoc b/src/main/asciidoc/jpa.adoc index 77ba47b63..05270c1d2 100644 --- a/src/main/asciidoc/jpa.adoc +++ b/src/main/asciidoc/jpa.adoc @@ -744,6 +744,19 @@ Note that the auditing feature requires `spring-aspects.jar` to be on the classp ---- ==== +You can also enable the `AuditingEntityListener` per entity using the `@EntityListeners` annotation: + +==== +[source, java] +---- +@Entity +@EntityListeners(AuditingEntityListener.class) +public class MyEntity { + +} +---- +==== + Now activating auditing functionality is just a matter of adding the Spring Data JPA `auditing` namespace element to your configuration: .Activating auditing using XML configuration