Help please: Click on grid row, selects a different row.

Spring boot, MongoDb, Vaadin 8.4.3
I have developed a Grid/Form UI. when I create records using this UI (with form bindings, etc), everything is fine. When I create records directly into the Mongo db, either manually using the MongoDb editor (RoboT and Compass) or saving a record using the same Spring Boot code that I use to save the record through the UI, the last record shown in the grid is fine - clicking on the row sets the focus and selects the row correctly (and fires a value change listener I use to load the record value into a form).
Clicking any other record sets the focus on that record correctly but selects the last record in the grid. The listener fires for the other record, not the one I clicked on.
See image1.jpg


Here’s an animated gif to show it in action.

I fixed it.
The issue was with my entity. I am using Lombok to generate all the getters and setters. The entity extended another entity and with Lombok you need to include the annotation @EqualsAndHashCode(callSuper = true) at the top of the child entity. I had originally set callSuper = false. When I changed it to callSuper = true, there was no longer a problem.
I worked this out by creating another grid with a simple entity (no extending) and the grid worked. I then gradually added to the entity and kept testing the grid until I found out what was causing the issue.