How to make screen aware data change of a json type in postgresql

Hi,
For cuba standard editor, when user click “cancel” and there are value changes of components have db property related , there will be warning that “data not saved”.

I have a json DB type which mapped to String type in the entity, and there are components related to each json key, which controlled by my code.

So when user click “cancel” , and one of the json key components has value changes, screen can’t know this and close without warning.

Is there some simpler way to make screen aware of the changes? I am thinking to add listeners for each components to mark the changes, but seems not smart。 Is there any smart way?

Hi,
For CUBA data context, in order to know that the entity has been modified - you have to invoke setter of some entity’s persistent property. Automatically when UI component’s value changes, or from your code:

entity.setJsonProperty(newValue);

Also in old datasources you were able to mark entity as modified manually:

((DatasourceImplementation) entityDs).modified(entity);

As I see, this method was not implemented in new CUBA 7 API (in DataContext class).