|
Spring Data JPA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.data.jpa.domain.support.AuditingEntityListener
@Configurable public class AuditingEntityListener
JPA entity listener to capture auditing information on persiting and updating entities. To get this one flying be
sure you configure it as entity listener in your orm.xml as follows:
<persistence-unit-metadata>
<persistence-unit-defaults>
<entity-listeners>
<entity-listener class="org.springframework.data.jpa.domain.auditing.support.AuditingEntityListener" />
</entity-listeners>
</persistence-unit-defaults>
</persistence-unit-metadata>
After that it's just a matter of activating auditing in your Spring config:
@Configuration
@EnableJpaAuditing
class ApplicationConfig {
}
<jpa:auditing auditor-aware-ref="yourAuditorAwarebean" />
| Constructor Summary | |
|---|---|
AuditingEntityListener()
|
|
| Method Summary | |
|---|---|
void |
setAuditingHandler(ObjectFactory<AuditingHandler> auditingHandler)
Configures the AuditingHandler to be used to set the current auditor on the domain types touched. |
void |
touchForCreate(Object target)
Sets modification and creation date and auditor on the target object in case it implements Auditable on
persist events. |
void |
touchForUpdate(Object target)
Sets modification and creation date and auditor on the target object in case it implements Auditable on
update events. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AuditingEntityListener()
| Method Detail |
|---|
public void setAuditingHandler(ObjectFactory<AuditingHandler> auditingHandler)
AuditingHandler to be used to set the current auditor on the domain types touched.
auditingHandler - must not be null.public void touchForCreate(Object target)
Auditable on
persist events.
target - public void touchForUpdate(Object target)
Auditable on
update events.
target -
|
Spring Data JPA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||