PL-7436 Add auto commit for nested entity while creating new entity

This commit is contained in:
Konstantin Krivopustov 2017-03-31 13:45:16 +04:00
parent c497688498
commit 3615b20178

View File

@ -186,6 +186,18 @@ public class EditorWindowDelegate extends WindowDelegate {
}
ds.setItem(item);
if (PersistenceHelper.isNew(item)) {
// The new item may contain references which were created in initNewItem() and are also new. Below we
// make sure that they will be saved on commit.
for (Datasource datasource : ds.getDsContext().getAll()) {
if (datasource instanceof NestedDatasource && ((NestedDatasource) datasource).getMaster() == ds) {
if (datasource.getItem() != null && PersistenceHelper.isNew(datasource.getItem()))
((DatasourceImplementation) datasource).modified(datasource.getItem());
}
}
}
((DatasourceImplementation) ds).setModified(false);
Security security = AppBeans.get(Security.NAME);