I have a problem very similar to that discussed in
https://vaadin.com/forum/#!/thread/2729098
and
http://blog.oio.de/2014/04/25/select-nested-javabeans-vaadin-fieldgroup/
An editor dialog for a “Component” object, which refers to an “Application” –
Containers:
private JPAContainer<Application> myapplications;
private JPAContainer<Component> mycomponents;
Form:
[code]
class CompForm extends FormLayout {
@PropertyId(“application”)
ComboBox application;
public CompForm() {
setSpacing(true);
application = new ComboBox("Application", myapplications);
application.setConverter(new SingleSelectConverter<Application>(application));
application.setImmediate(true);
addComponent(application);
this.setImmediate(true);
}
}
[/code]And then use it with a field group:
[code]
editorForm = new CompForm();
fieldGroup = new FieldGroup(componentItem);
fieldGroup.setBuffered(true);
fieldGroup.bindMemberFields(editorForm);
[/code]Everything works – I have the elements of the JPAContainer in the ComboBox, and if one is selected, the write to the database is done correctly.
However, the values displayed in the combobox are the database’s ApplicationId integer values. Based on what I had read so far, using SingleSelectConverter() should cause the toString() representation from the Application bean to be displayed instead. What am I doing wrong here?
Thanks.