Different entities in Lookup Screen and Editor Screen

It’s possible to use one entity in lookup screen and another one in editor screen. ?. Our goal is to use a database view as entity for lookup screen and underlaying database table as entity for editor screen. We’ve tested that condition and underlaying database table is edited and committed without problems but EditorBuilderProcessor raise an execption when try to synchronise editor screen entity and lookup screen entity.

Take a look at this example in UI Samples app: https://demo.jmix.io/sampler/#main/sample?id=readonly-customers

Basically, you need to redefine create/edit actions and use ScreenBuilders API to invoke a desired edit screen and reload the changed data afterwards, for example:

    @Subscribe("readOnlyCustomersTable.edit")
    public void onReadOnlyCustomersTableEdit(Action.ActionPerformedEvent event) {
        ReadOnlyCustomer readOnlyCustomer = readOnlyCustomersTable.getSingleSelected();
        if (readOnlyCustomer == null)
            return;
        Customer customer = dataManager.load(Customer.class).id(readOnlyCustomer.getId()).one();

        screenBuilders.editor(Customer.class, this)
                .editEntity(customer)
                .withScreenClass(CustomerEdit.class)
                .withOpenMode(OpenMode.DIALOG)
                .withAfterCloseListener(afterCloseEvent -> {
                    if (afterCloseEvent.closedWith(StandardOutcome.COMMIT)) {
                        readOnlyCustomersDl.load();
                    }
                })
                .show();
    }

Thanks Konstantin, this solution works perfectlly !.