Hello,
after quite a while I restart working with cuba.
I am working on an external datastore with given data-structures and have i.e. to set edit-by and edit-Timestamp of the existing structure, and I can not use the existing cuba-columns.
I used to handle changes to an entity like for instance setting special timestamp values just before committing by using the BeforeInsertEntityListener and the BeforeUpdateEntityListener - interfaces.
Using these interfaces and the onBeforeInsert( entity, entityManager) /
onBeforeUpdate(entity, entityManager) methods made it easy to manipulate the entity before writing to the database, because the entity is given as a parameter.
Now there is the new EntityChangedEventListener where in the beforePersist() method i get the entity which I can manipulate, but in the beforeCommit() I just get the id of the entity, and not the entity itself, so that I have to read the entity. And I only found an example how to manipulate i.e. child or parent objects and save them, rather than manipulating the entity itself.
I know that the old listeners are still usable when implementing “by hand”, but I wonder if there is a drawback when using the old methods in any kind. Or do I missing some in handling the entity when using the new EntityChangedEventListener?
What would be the right/best way to do this?
Thanks
Manfred