Double saving issue when creating entities through dialogs

Hi
I encountered a bug that is quite simple. I create entities using the create action of a datagrid (like in the screenshot below) then when I try to save it all, the parent entity is saved twice, leading to an exception Unique constraint violation occurred (PK_MAIN_ENTITY). I think that the parentDataContext is not forwarded correctly to the child dialogs.
image
image

zip sample project:
doubleSaveDialog.zip (1.0 MB)

Hello!

Try to make the relations as Composition for:

  • MainEntity#comments
  • Comment#contacts.

It will save composition entities only if parent context will be saved. You can refer to a guide about Composition relation: Data Modeling: Composition :: Jmix Documentation