Hi Federico,
Most probably you get this exception because your entity is optimistically locked (has a @Version
attribute) and you don’t set the saved entity instance back to the data container.
We’ve just updated the relevant UI sample: https://demo.jmix.io/ui-samples/sample/data-grid-inline-editor, it now describes how to save changes when using DataGrid inline editor. Particularly, take a look at this method:
private void saveChanges(Customer customer) {
// Save changed entity
Customer savedCustomer = dataManager.save(customer);
// Replace the original entity in the data container with the saved one
customersDc.replaceItem(savedCustomer);
// Note that if the original entity is merged into DataContext (this is the
// case when <loader readOnly="false">), the saved instance should be merged too
notifications.show("Changes saved to the database");
}
The documentation will be updated too.
Let us know if you need further clarification.
Regards,
Konstantin