Get Entity Id in EditScreen after create and commit

Hi,

I think I found the reason for my problem.

I recreated some screens from scratch and it worked on the new screens. Then I merged the changes until it did not work anymore.

The reason it did not work is, that the “data” tag was not marked as readonly=“true”.
The database table is read only, but the entity in CUBA is not defined as read only. It seems, that in CUBA 7, it still needs to be declared as read only, but only when the entity base class is “BaseLongIdEntity”.

Before and not working:

<!-- ... -->
    <data>
        <collection id="kndDtnsDc" class="de.nexloy.crm.vorgangsverwaltung.entity.KndDtn" view="KndDtn-screen-view">
            <loader id="kndDtnsDl">
                <query><![CDATA[select e from vorgangsverwaltung$KndDtn e ]]></query>
            </loader>
        </collection>
    </data>
<!-- ... -->

Afterwards and working:

<!-- ... -->
    <data readOnly="true">
        <collection id="kndDtnsDc"
                    class="de.nexloy.crm.vorgangsverwaltung.entity.KndDtn"
                    view="KndDtn-screen-view">
            <loader id="kndDtnsDl">
                <query>
                    <![CDATA[select e from vorgangsverwaltung$KndDtn e]]>
                </query>
            </loader>
        </collection>
    </data>
<!-- ... -->

I hope you can explain me, why that makes a difference. I still do not quite understand, why this is important.

Kind regards,
J

Hi,
This is not normal, browser screens without readOnly="true" work well with entities extending BaseLongIdEntity.
Please provide a test project.

Sure, please provide DDL for the Oracle table corresponding to KndDtn entity.

Hi,

As it turned out after investigation, the cause is that your entity does not have setters for the most fields, so the attributes are effectively read-only. It prevents the state to be merged into DataContext (until it is not read-only).

So just add all standard getters and setters, and your entity will be displayed correctly in all screens.

Regards,
Konstantin

Thank you very much again. That solved the problem I had.