# Using Spring Data @DomainEvents with JPA and Hibernate

DevFeed: [Using Spring Data @DomainEvents with JPA and Hibernate](<https://devfeed.tech/articles/poor-s-man-domain-events-27284.md>)

Original publisher: [Read original article](<https://blog.pchudzik.com/201710/domain-events/>)

Published: 2017-10-16T00:00:00Z

Content type: tutorial

Language: en

Sources: [Paweł Chudzik](<https://devfeed.tech/sources/pawe-chudzik.md>)

Topics: [jpa](<https://devfeed.tech/topics/jpa.md>), [Hibernate](<https://devfeed.tech/topics/hibernate.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [hibernate](<https://devfeed.tech/tags/hibernate.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [jpa](<https://devfeed.tech/tags/jpa.md>), [spring](<https://devfeed.tech/tags/spring.md>)

## AI overview

This tutorial examines Spring Data's @DomainEvents and @AfterDomainEventPublication annotations, explains their repository-based event publishing behavior, and discusses why that behavior does not work automatically for commonly used JPA dirty checking. It then presents Hibernate interceptor-based event propagation as an approach for JPA entities.

## Source excerpt

While investigating @EventListeners in spring I've noticed very interesting annotation - @DomainEvents. In this post I'm going to check what can be achieved using @DomainEvents annotation and how to effectively use it with old good JPA. Let's start with short introduction to domain event idea if you are not yet familiar with it. Now let's go back to the @DomainEvents annotation in spring-data. Spring-data by default provides support for this annotation and it's complementary annotation @AfterDomainEventPublication. Read more