DevelopmentException: View finzpix_Tipo_Egresos/ definition error: property categoria doesn't exist

Hi!

I got this error:

DevelopmentException: View finzpix_Tipo_Egresos/ definition error: property categoria doesn't exist

I am building a basic CRUD, with one entity that has two foreign keys, I can browse and edit using data from the foreignt tables, I made the same with this one (tipo_egresos - fk(categoria)) and I get this error, I did the same process from the quickstart video, but I hit this error, any ideas?

Thanks and regards

Hi @fsalaman,

It looks like the view is defined right in the screen as it doesn’t have any name assigned. The exception says that one of the declared properties doesn’t point to a corresponding field in the entity declaration.

E.g. you have the following entity:

@Table(name = "PETCLINIC_FOO")
@Entity(name = "petclinic_Foo")
public class Foo extends StandardEntity {
    private static final long serialVersionUID = -7855734783247361811L;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "USER_ID")
    private User user;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}

In the browser screen, you have the following data container declaration:

    <data readOnly="true">
        <collection id="foosDc"
                    class="com.haulmont.sample.petclinic.entity.Foo">
            <view extends="_local">
                <property name="user" view="_minimal"/>
                <property name="fieldDoesntExist" view="_minimal"/>
            </view>
            <loader id="foosDl">
                <query>
                    <![CDATA[select e from petclinic_Foo e]]>
                </query>
            </loader>
        </collection>
    </data>

In this case, you will get the mentioned exception, because the fieldDoesntExist field is not declared in the Foo entity.

Regards,
Aleksey

Hi @stukalov !

It seems I have “categoria” defined in my entity:

@Table(name = "FINZPIX_TIPO_EGRESOS", uniqueConstraints = {
        @UniqueConstraint(name = "IDX_FINZPIX_TIPO__EGRESOS_UNQ", columnNames = {"ID"}),
        @UniqueConstraint(name = "IDX_FINZPIX_TIPO__EGRESOS_UNQ_1", columnNames = {"CATEGORIA_ID"})
})
@Entity(name = "finzpix_Tipo_Egresos")
public class Tipo_Egresos extends StandardEntity {
    private static final long serialVersionUID = -5761447592470752979L;

    @NotNull
    @Column(name = "TIPO", nullable = false, unique = true, length = 150)
    protected String tipo;

    @OnDeleteInverse(DeletePolicy.CASCADE)
    @OnDelete(DeletePolicy.UNLINK)
    @NotNull
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "CATEGORIA_ID")
    protected Categoria_Egresos categoria;

    public Categoria_Egresos getCategoria() {
        return categoria;
    }

    public void setCategoria(Categoria_Egresos categoria) {
        this.categoria = categoria;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }
}

The browser screen:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
        xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
        caption="msg://browseCaption"
        focusComponent="tipo_EgresosesTable"
        messagesPack="com.company.finzpix.web.screens.tipo_egresos">
    <data readOnly="true">
        <collection id="tipo_EgresosesDc"
                    class="com.company.finzpix.entity.Tipo_Egresos"
        >
            <view extends="_local">
                <property name="categoria" view="_minimal"/>
            </view>
            <loader id="tipo_EgresosesDl">
                <query>
                    <![CDATA[select e from finzpix_Tipo_Egresos e]]>
                </query>
            </loader>
        </collection>
    </data>
    <dialogMode height="600"
                width="800"/>
    <layout expand="tipo_EgresosesTable"
            spacing="true">
        <filter id="filter"
                applyTo="tipo_EgresosesTable"
                dataLoader="tipo_EgresosesDl">
            <properties include=".*"/>
        </filter>
        <groupTable id="tipo_EgresosesTable"
                    width="100%"
                    dataContainer="tipo_EgresosesDc"
                    presentations="true">
            <actions>
                <action id="create" type="create"/>
                <action id="edit" type="edit"/>
                <action id="remove" type="remove"/>
                <action id="add" type="add"/>
            </actions>
            <columns>
                <column id="tipo"/>
                <column id="categoria"/>
            </columns>
            <rowsCount/>
            <buttonsPanel id="buttonsPanel"
                          alwaysVisible="true">
                <button id="createBtn" action="tipo_EgresosesTable.create"/>
                <button id="editBtn" action="tipo_EgresosesTable.edit"/>
                <button id="removeBtn" action="tipo_EgresosesTable.remove"/>
                <button id="addBtn" action="tipo_EgresosesTable.add"/>
            </buttonsPanel>
        </groupTable>
        <hbox id="lookupActions" spacing="true" visible="false">
            <button action="lookupSelectAction"/>
            <button action="lookupCancelAction"/>
        </hbox>
    </layout>
</window>

It would be great if you could reproduce this issue in a sample project and send it over to us, so we could debug it.

Regards,
Aleksey

Solved, didn’t update DDLs, guess I changed the Entity after I ran my DDLs,

Thanks a lot!!!

1 Like