Fragment with provided datacontainer creating new master entity instance doubt

Hi, i created a fragment with provided datacontainer and used as part of master entity view.

In editing operations, no problem, binding is ok.
In creation mode i need to manage this code to instantiate and assign to master the detail entity. (TipoDatiControlloEntity is the detail entity)

@Subscribe(id = “datiControlloDc”, target = Target.DATA_CONTAINER)
public void onDatiControlloDcItemChange(final InstanceContainer.ItemChangeEvent event) {
if (event.getItem() == null) {
getEditedEntity().setDatiControllo(dataManager.create(TipoDatiControlloEntity.class));
}
}

The question is: it the right way to manage that?!

Hi,

Could you please attache a demo project that reproduces the issue?

Regards,
Gleb