Select.getValue() always returns null

I am new to Vaadin and am trying to use a drop down menu to pick a value from a database table. I’m using a JPAContainer to populate the Select field and this is working fine. The problem is when I select a value in the drop down list it calls the valueChange method, but the getValue() method always returns null.

Below is the code used to create the Select field. I have also tried using ComboBox fields.


        Select employeeCombo = new Select("Employee");
    	employeeContainer =	JPAContainerFactory.make(Employee.class, entityManagerFactory.createEntityManager());
    	
    	employeeCombo.setPropertyDataSource(new SingleSelectTranslator(employeeCombo));
    	employeeCombo.setContainerDataSource(employeeContainer);  
    	employeeCombo.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    	employeeCombo.setItemCaptionPropertyId("name");
    	employeeCombo.setImmediate(true);
    	
    	employeeCombo.addListener(new Select.ValueChangeListener() 
    		{
		    @Override
	            public void valueChange(ValueChangeEvent event) 
		    {
			System.out.println("test " + event.getProperty().getValue());
			Employee employee = (Employee) event.getProperty().getValue();
	            }
    		});

Am I doing something wrong or is this a bug? Amy working examples would be really appreciated.

I found a solution to this here:

http://demo.vaadin.com/book-examples/book/#jpacontainer.filtering.entity