BeanItemContainer with Hibernate POJOs in OptionGroup

I am trying to use an OptionGroup in the following manner with hibernate.

private OptionGroup getOptionGroup(BaseManager manager, boolean multiSelect) {
	OptionGroup og = new OptionGroup();
	BeanItemContainer container = new BeanItemContainer(
	return og;

After doing a save I am getting the following exception

09:56:30,421 ERROR [STDERR]
Caused by:$ConversionException: java.lang.reflect.InvocationTargetException
09:56:30,421 ERROR [STDERR]
09:56:30,421 ERROR [STDERR]
at com.vaadin.ui.AbstractField.setValue(
09:56:30,421 ERROR [STDERR]
… 24 more

From the examples I’ve seen it seems like this is the way a BeanItemContainer is intended to be used, that is managing a list of POJOs. Do I need to add all of the the properties of my POJO to the BeanItemContainer via addContainerProperty? And why is it setting these properties at all?

What is the correct way to render an OptionGroup from a list of POJOs where the POJO has both an ID and a Caption that you’d like to display?

The example looks ok to me. I tested it (after modifying it to work without “BaseManager”) and there is no ConversionException thrown so I guess the problem comes from the code you have not posted.