I was able to populate a list with data ouf of my beans:
BeanItemContainer<Student> c = new BeanItemContainer<Student>(Student.class);
for (Student s : this.studentBean.getAll()) {
c.addBean(s);
}
studentList.setContainerDataSource(c);
And I was able to make a form ouf of this. The form is populated with the data of the selected item in the table.
The problem I am facinc is that the changed data do not arrive in the database.
My form has a submit / commit-Button, but is there any magic needed that the data arrive in the database?
If you are using a BeanItemContainer, all it handles is the in-memory processing, so your commit logic needs to save the data in one way or another. You can to this where you call commit(), or you could even override the Form.commit() method.
Some other containers are more directly connected to a database and perform updates when an item or its property is modified using the Item and Property interfaces as Form does - but they cannot listen to direct changes to the underlying bean.
You could get rid of the casts by using a BeanItemContainer and keeping a reference to it, fetching the item from it rather than from the list. That way, getItem(…) returns a BeanItem, and its getBean() returns a Student.