Parent field does not come in query window of child element

I get an error when the screen opens.

IllegalStateException: Cannot get unfetched attribute [genericFileDefinition] from detached object com.ferda.enterprisesecvis.entity.GenericFileElement-0047a204-4365-b226-50a3-a662955855ad [detached].

I looked at the docs. It says that i should create a view including parent element for the child and use that view in ds of child element. I already did that.

When I create new child element i can create the record correctly (with parent element and other fields).

This is the code for the screen

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
        caption="msg://caption"
        class="com.ferda.enterprisesecvis.web.genericfileelement.GenericFileElementBrowse"
        focusComponent="genericFileElementsTable"
        lookupComponent="genericFileElementsTable"
        messagesPack="com.ferda.enterprisesecvis.web.genericfileelement">
    <dsContext>
        <datasource id="genericFileElementDs"
                    class="com.ferda.enterprisesecvis.entity.GenericFileElement"
                    view="genericFileElement-view"/>
        <groupDatasource id="genericFileElementsDs"
                         class="com.ferda.enterprisesecvis.entity.GenericFileElement"
                         view="genericFileElement-view">
            <query>
                <!&#91;CDATA&#91;select e from enterprisesecvis$GenericFileElement e&#93;&#93;>
            </query>
        </groupDatasource>
    </dsContext>
    <actions>
        <action id="save"
                caption="mainMsg://actions.Ok"
                icon="icons/ok.png"
                invoke="save"
                shortcut="CTRL-ENTER"/>
        <action id="cancel"
                caption="mainMsg://actions.Cancel"
                icon="icons/cancel.png"
                invoke="cancel"/>
    </actions>
    <dialogMode height="600"
                width="800"/>
    <layout>
        <split id="split"
               height="100%"
               orientation="horizontal"
               reversePosition="true"
               width="100%">
            <vbox id="lookupBox"
                  height="100%"
                  margin="false,true,false,false"
                  spacing="true">
                <filter id="filter"
                        applyTo="genericFileElementsTable"
                        datasource="genericFileElementsDs">
                    <properties include=".*"/>
                </filter>
            </vbox>
            <vbox id="editBox"
                  expand="fieldGroupBox"
                  height="100%"
                  spacing="true">
                <vbox id="fieldGroupBox">
                    <fieldGroup id="fieldGroup"
                                datasource="genericFileElementDs">
                        <column width="250px">
                            <field property="name"/>
                            <field property="type"/>
                            <field property="parentName"/>
                            <field property="genericFileDefinition"/>
                        </column>
                    </fieldGroup>
                    <groupTable id="genericFileElementsTable"
                                height="100%"
                                width="100%">
                        <actions>
                            <action id="create"/>
                            <action id="edit"/>
                            <action id="remove"/>
                        </actions>
                        <columns>
                            <column id="name"/>
                            <column id="type"/>
                            <column id="parentName"/>
                            <column id="genericFileDefinition"/>
                        </columns>
                        <rows datasource="genericFileElementsDs"/>
                        <rowsCount/>
                        <buttonsPanel id="buttonsPanel"
                                      alwaysVisible="true">
                            <button id="createBtn"
                                    action="genericFileElementsTable.create"/>
                            <button id="editBtn"
                                    action="genericFileElementsTable.edit"/>
                            <button id="removeBtn"
                                    action="genericFileElementsTable.remove"/>
                        </buttonsPanel>
                    </groupTable>
                </vbox>
                <hbox id="actionsPane"
                      spacing="true"
                      visible="false">
                    <button id="saveBtn"
                            action="save"/>
                    <button id="cancelBtn"
                            action="cancel"/>
                </hbox>
            </vbox>
        </split>
    </layout>
</window>

This picture shows where the view stays.

view

I do not see the property fields in the views.xml although i choosed them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?> probably there is a bug the xml file does not include the properties that i selected

I manually wrote the fields however after sometime (probably after restart of studio) when i checked the views file i see that property fields are not there.

Later, I removed the view and recreated the view nothing changes. The properties are not saved to the views.xml.

Hi,

It is quite difficult to get a full picture from these pieces. Could you please attach a small project where the problem is reproduced.

You can use a zipProject gradle task in Studio to compress the project.

It might also be interesting for you to take a look at this article.