BeanFieldWrapper with HbnContainer

hi everybody,

how to use BeanFieldWrapper (from customfield) with HbnContainer?

I’ve try with following code, but when form commit, new item has null instead of correct company id.

Could anyone provide any help?

[u]
companiesContainer = new HbnContainer<Company>(Company.class, this.app);
[/u]

    ............................

    setFormFieldFactory(new DefaultFieldFactory() {
      @Override
      public Field createField(Item item, Object propertyId,
          Component uiContext) {
        Field field;
        if (propertyId.equals("company")) {
          Select companies = new Select("Choose company",companiesContainer);
          companies.setNewItemsAllowed(false);
          companies.setNullSelectionAllowed(false);
          companies.setItemCaptionPropertyId("name");
          companies.setImmediate(true);
          [u]
field = new BeanFieldWrapper<Company>(companies, Company.class, companiesContainer, "id");
[/u]
        }

    ............................

    }