You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thus, implicitly, I guess one could infer that a PreUpdateEvent event should occur in the first case, and a PreInsertEvent in the second case.
But in many cases, the most efficient implementation of @Save is using an upsert (e.g. a SQL MERGE statement), and in that case we would not know whether we're observing an update or insert until after the operation is executed.
A possible solution is to introduce a new event type PreUpsertEvent (or PreMergeEvent).
Thoughts?
The text was updated successfully, but these errors were encountered:
PreInsertEvent states that is is specifically for @Insert: "An event that occurs when an {@link jakarta.data.repository.Insert} lifecycle method is called..."
And similar for PreUpdateEvent: "An event that occurs when an {@link jakarta.data.repository.Update} lifecycle method is called..."
My interpretation of what is currently defined is that no events would be sent for @Save.
It agree it would be a good idea to clarify after deciding on what behavior we want for it. A new event type for Save seems appropriate.
As a ...
I need to be able to ...
have well-defined behavior of lifecycle events when
@Save
is implemented as an upsert.Which enables me to ...
not be surprised.
Additional information
Currently, the documentation for
@Save
says:Thus, implicitly, I guess one could infer that a
PreUpdateEvent
event should occur in the first case, and aPreInsertEvent
in the second case.But in many cases, the most efficient implementation of
@Save
is using an upsert (e.g. a SQLMERGE
statement), and in that case we would not know whether we're observing an update or insert until after the operation is executed.A possible solution is to introduce a new event type
PreUpsertEvent
(orPreMergeEvent
).Thoughts?
The text was updated successfully, but these errors were encountered: