Skip to content

Commit 5409371

Browse files
committed
Update event documentation to reflect the notification-only aspect of lifecycle events.
Closes #1538
1 parent 3a9f583 commit 5409371

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/asciidoc/jdbc.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ When your database has an auto-increment column for the ID column, the generated
436436
One important constraint is that, after saving an entity, the entity must not be new any more.
437437
Note that whether an entity is new is part of the entity's state.
438438
With auto-increment columns, this happens automatically, because the ID gets set by Spring Data with the value from the ID column.
439-
If you are not using auto-increment columns, you can use a `BeforeConvert` listener, which sets the ID of the entity (covered later in this document).
439+
If you are not using auto-increment columns, you can use a `BeforeConvertCallback` to set the ID of the entity (covered later in this document).
440440

441441
[[jdbc.entity-persistence.read-only-properties]]
442442
=== Read Only Properties
@@ -858,7 +858,9 @@ Note that the type used for prefixing the statement name is the name of the aggr
858858
[[jdbc.events]]
859859
== Lifecycle Events
860860

861-
Spring Data JDBC triggers events that get published to any matching `ApplicationListener` beans in the application context.
861+
Spring Data JDBC publishes lifecycle events to `ApplicationListener` objects, typically beans in the application context.
862+
Events are notifications about a certain lifecycle phase.
863+
In contrast to entity callbacks, events are intended for notification. Transactional listeners will receive events when the transaction completes.
862864
Events and callbacks get only triggered for aggregate roots.
863865
If you want to process non-root entities, you need to do that through a listener for the containing aggregate root.
864866

@@ -912,7 +914,6 @@ The following table describes the available events. For more details about the e
912914

913915
| {javadoc-base}/org/springframework/data/relational/core/mapping/event/BeforeConvertEvent.html[`BeforeConvertEvent`]
914916
| Before an aggregate root gets converted into a plan for executing SQL statements, but after the decision was made if the aggregate is new or not, i.e. if an update or an insert is in order.
915-
This is the correct event if you want to set an id programmatically.
916917

917918
| {javadoc-base}/org/springframework/data/relational/core/mapping/event/BeforeSaveEvent.html[`BeforeSaveEvent`]
918919
| Before an aggregate root gets saved (that is, inserted or updated but after the decision about whether if it gets inserted or updated was made). Do not use this for creating Ids for new aggregates. Use `BeforeConvertEvent` or even better `BeforeConvertCallback` instead.

0 commit comments

Comments
 (0)