ComboBox and BeanContainer

Hello,

in our Vaadin application we use a
lot
comboboxes.
Usually
only
with two values ​​(id and value).

Do I now write for each Combo a BeanContainer with its own class?
Or is there a
simpler
way to put two values ​​from a database into a ComboBox?


Sample
:



 BeanContainer<String, Vertrag> [b]
container 
[/b]= new BeanContainer<String, Vertrag>(Vertrag.class);
 container.setBeanIdProperty("id");

... select form Database:

while(){
       //put Value into Bean
       [b]
container
[/b].addBean(new Vertrag(String xy, String id));
}

 //put BeanContainer into ComboBox...
 cbxvertrag.setContainerDataSource(container);
 cbxvertrag.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
 cbxvertrag.setItemCaptionPropertyId("name");

Many thanks in advance



ComboBox cb = new ComboBox();
cb.addItem("FED");
cb.setItemCaption("FED", "Federation");
cb.addItem("INV");
cb.setItemCaption("INV", "Innovation");
main.addComponent(cb);

and



// to show the value:
cb.setImmediate(true); // update the label immediatly
Label selected = new Label(cb);
main.addComponent(selected);