HI everyone in a entity listener what’s the difference between saving event and entity changed (before and before commit) events?
Hi Federico,
The difference is fundamental. Let me share some quotes from Entity Events :: Jmix Documentation.
EntityChangedEvent
is sent by the framework when an entity instance is saved to the database.
… at the time of the event, the database already contains the changed data.
EntityChangedEvent
contains change type (create, update or delete), the identifier of the changed entity, the information on what attributes were changed, and old values of changed attributes.
EntitySavingEvent
is sent by the framework when an entity instance is about to be saved to the database. As opposed to EntityChangedEvent, which contains the entity id,EntitySavingEvent
contains the entity instance itself.
Let me know if you need further clarification.
Regards,
Konstantin