Vaadin 7: NativeSelect and BeanFieldGroup doesn't change with nested entity

Hello,

I am trying the following problem for the last 5 hours - so perhaps its a good idea to ask :wink:

I have two entities:

public class Schulart implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String name;

    @OneToMany(mappedBy = "schulart")
    private Set<Schule> schulen;
...

and

public class Schule {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String name;

    @NotNull
    @ManyToOne
    private Schulart schulart;

....

My form-code is

public class SchuleForm extends CustomComponent {

    private final BeanFieldGroup editorFieldGroup;
    private JPAContainer<Schulart> schulartenFuerSelect;
    private JPAContainer<Schule> schulen;

    public SchuleForm() {

        schulartenFuerSelect = JPAContainerFactory.make(Schulart.class, OgsUI.PERSISTENCE_UNIT);
        schulen = JPAContainerFactory.make(Schule.class, OgsUI.PERSISTENCE_UNIT);

        FormLayout editor = new FormLayout();
        editorFieldGroup = new BeanFieldGroup<Schule>(Schule.class);
        editorFieldGroup.setBuffered(true);

        BeanItem<Schule> zwBeanItem = new BeanItem<Schule>(new Schule());
        editorFieldGroup.setItemDataSource(zwBeanItem);

        TextField name = new TextField("Name der Schule: ");
        name.setNullRepresentation("");
        editorFieldGroup.bind(name, "name");

        NativeSelect select = new NativeSelect("Schulart");
        select.setItemCaptionPropertyId("name");
        select.setContainerDataSource(schulartenFuerSelect);
        editorFieldGroup.bind(select, "schulart");

...

in my view there is a

SchuleForm c = new SchuleForm();

and in my ClickListener on my table I have

BeanItem<Schule> s = new BeanItem<Schule>( schulen.getItem(event.getItemId()).getEntity() );
c.setItemDataSource(s);

I thought that the new datasource in c.setItemDataSource(s) shoult result in showing the values of s in the form. And correctly the TextField name is changed when the ClickEvent triggers - but the NativeSelect does not change, it stays empty.

What did I wrong?

Thanks in advance

Martin