Error refreshing Table without changing the focus

I suppose that is a recurrent question but I don’t understand what happend I’ll explain the problem with this pseudocode. I’m using Vaadin 7.4.6 and a selected table with a BeanItemContainer and a collection of pojos:

  1. Query all beans and create a BeanItemContainer and set the data container to my Selected Table (OK):
    // create the BeanItemContainer with data
    BeanItemContainer myContainer = new BeanItemContainer(MyBean.class);

    // Bind Table with my BeanItemContainerd filled

  2. Select a bean from table:
    MyBean myBean = (MyBean)myTable.getValue(); (OK)

  3. Edit myBean with a Form change something, persist and refresh BeanItemContainer and Table (OK)
    int position = myContainer.indexOfId(myBean);
    MyBean myBeanSaved =;
    myBeanContainer.addItemAt(position, myBeanSaved);

  4. Without change the focus in my Table (maintain the same position) select again the same item from table, the item is not the myBeanSaved it’s the oldBean, that is the bean with tha atributes changed but in memory the id is the old one.
    MyBean myBean = (MyBean)myTable.getValue(); (BAD)

  5. If change the focus of the item from my table, select other item and again select the edited item, and edit again now the item selected is right, that is the memory id is correct (OK)

I must change the focus of the table to propagate the BeanItemContainer to the selected table, Why?, what is wrong??