Skip to content

Commit 09dfbf1

Browse files
committed
Clarify that events and callbacks documentation.
Events and callbacks only get triggered for aggregate roots. Closes #1328
1 parent 3f1dab9 commit 09dfbf1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/asciidoc/jdbc.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,10 @@ Note that the type used for prefixing the statement name is the name of the aggr
833833
== Lifecycle Events
834834

835835
Spring Data JDBC triggers events that get published to any matching `ApplicationListener` beans in the application context.
836+
Events and callbacks get only triggered for aggregate roots.
837+
If you want to process non-root entities, you need to do that through a listener for the containing aggregate root.
836838

837-
Entity lifecycle events can be costly and you may notice a change in the performance profile when loading large result sets.
839+
Entity lifecycle events can be costly, and you may notice a change in the performance profile when loading large result sets.
838840
You can disable lifecycle events on the link:{javadoc-base}org/springframework/data/jdbc/core/JdbcAggregateTemplate.html#setEntityLifecycleEventsEnabled(boolean)[Template API].
839841

840842
For example, the following listener gets invoked before an aggregate gets saved:
@@ -855,7 +857,7 @@ ApplicationListener<BeforeSaveEvent<Object>> loggingSaves() {
855857
====
856858

857859
If you want to handle events only for a specific domain type you may derive your listener from `AbstractRelationalEventListener` and overwrite one or more of the `onXXX` methods, where `XXX` stands for an event type.
858-
Callback methods will only get invoked for events related to the domain type and their subtypes so you don't require further casting.
860+
Callback methods will only get invoked for events related to the domain type and their subtypes, therefore you don't require further casting.
859861

860862
====
861863
[source,java]

0 commit comments

Comments
 (0)