Identifiers must exist in the container or as a generated column

I am developing a vaadin application and now I can not solve the following problem.

I have an object model:

public class MyModel {

    private long id;
    private Date dValidoAl;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Date getDValidoAl() {
        return dValidoAl;
    }

    public void setDValidoAl(Date dValidoAl) {
        this.dValidoAl = dValidoAl;
    }

}

Now I am trying to bind this object to the BeanItemContainerfollowing:

Table table = new Table();
BeanItemContainer<MyModel> container = new BeanItemContainer<MyModel>(MyModel.class);
table.setContainerDataSource(container);

Object[] visibleProperties = new Object[] { "id", "dValidoAl" };
String[] columnsHeader = new String[] { "Id", "Inizio Validitร " };
table.setVisibleColumns(visibleProperties);
table.setColumnHeaders(columnsHeader);

but I get this error:

Identifiers must exist in the container or as a generated column, id is missing: dValidoAl

Where am I doing wrong?

+4
source share
1 answer

As published by @Skizzo, and as defined in Vaadinโ€™s book , the BeanItemContainer (a BeanContainer implementation) will accept getters and setters as propertyIds.

, getter setter. , bean , , . beans .

, DValidoAl Id , .

+1