Buffered.SourceException when changing PropertyDataSource of a table

I have an error and i’m not quite sure if it is a bug or if it is just me using vaadin wrong :wink:
I have a table with items stored in a BeanContainer. I added an ObjectProperty named “selectedItem” for the table (with setPropertyDataSource).
Then i select an item within the table - no problems here. But when i try to reset the selection with “selectedItem.setValue(null)” i get a Buffered.SourceException:

Terminal error:
                                 com.vaadin.data.Buffered$SourceException
	at com.vaadin.ui.AbstractField.setValue(AbstractField.java:511)
	at com.vaadin.ui.AbstractSelect.setValue(AbstractSelect.java:666)
	at com.vaadin.ui.AbstractSelect.changeVariables(AbstractSelect.java:475)
	at com.vaadin.ui.Table.changeVariables(Table.java:2023)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1288) ...

I have created a simple Application with which the behaviour can be reproduced:

public class TestApplication extends Application {
	@Override
	public void init() {
		Window mainWindow = new Window("Test Application");
		
		
		VerticalLayout mainLayout = new VerticalLayout();
		mainLayout.setSizeFull();
		mainLayout.setMargin(false);
		
		
		
		Table table = new Table();
		table.setSelectable(true);
		final ObjectProperty<DTO> tableSelectedItem = new ObjectProperty<DTO>(null, DTO.class);
		BeanContainer<String, DTO> tableBeanContainer = new BeanContainer<String, DTO>(DTO.class);
		tableBeanContainer.setBeanIdProperty("id");
		
		DTO selectedDTO = new DTO("1", "a", "a");
		tableBeanContainer.addBean(selectedDTO);
		tableBeanContainer.addBean(new DTO("2", "b", "b"));
		tableBeanContainer.addBean(new DTO("3", "c", "c"));
		
		table.setPropertyDataSource(tableSelectedItem);
		table.setContainerDataSource(tableBeanContainer);
		
		Button resetSelection = new Button("Reset");
		resetSelection.addListener(new Button.ClickListener() {
			public void buttonClick(ClickEvent event) {
				tableSelectedItem.setValue(null);
			}
		});
		
		
		mainLayout.addComponent(table);
		mainLayout.addComponent(resetSelection);
		
		
		mainWindow.setContent(mainLayout);
		setMainWindow(mainWindow);
	}
	
	public class DTO {
		private String id;
		private String foo;
		private String bar;
		
		public DTO(String id, String foo, String bar) {
			super();
			this.id = id;
			this.foo = foo;
			this.bar = bar;
		}
		
		public String getId() {
			return id;
		}
		
		public void setId(String id) {
			this.id = id;
		}
		public String getFoo() {
			return foo;
		}
		public void setFoo(String foo) {
			this.foo = foo;
		}
		public String getBar() {
			return bar;
		}
		public void setBar(String bar) {
			this.bar = bar;
		}
		
	}

}

Maybe this is the same problem as mentiond here:
http://vaadin.com/de/forum/-/message_boards/view_message/181438

The property of the table is the item ID of the currently selected item. In your BC, the item ID type is String. Therefore, the property type of the table selection value must also be a String. So, you should have an ObjectProperty instead of ObjectProperty.

Ahh, yes that sounds logical to me.
Thank you for your explaination!