JPAContainer CustomFields FieldGroup

Hello.
I’m trying to bind a CustomField with JPAContainer and a FieldGroup

AddressCustomField addressField = new AddressCustomField(person.getEntity().getAddress());
fieldGroup.bind(addressField, Person.Fields.address.name());
formLayout.addComponent(addressField);

....

public AddressCustomField(Address address){
        fieldGroup = new BeanFieldGroup<Address>(Address.class);
        fieldGroup.setItemDataSource(new BeanItem<Address>(address));
    }

....

When I do fieldGroup.commit(), nothing happens.

What’s wrong?

Please tell us how to bind nested fields with a JPAContainer & FieldGroup

CustomField is not the answer I expected.

After days of suffering and doubt, the answer is:

To bind a Nested Property inside a FieldGroup using EntityItem

EntityItem<Person> person;
...

person.addNestedContainerProperty("address.street");
formLayout.addComponent(fieldGroup.buildAndBind("address.street"));

To work properly, is mandatory that Person initializes its nested properties in the constructor, or else you get an error when do a fieldGroup.commit();