CRUD with MongoDB DataProvider

I am struggling to create a DataProvider for the Vaadin CRUD to a MongoDB. I have managed to get it to sort of work, but there is this one wierd thing I can’t seem to get a hold on. If i edit one of the document with the built in edit functionality it all goes smooth with both the update in the database and to the grid, but if I try to edit the same line again there is no document in the form. The addSelectionListener doesn’t even work properly on that line meaning it doesn’t fire any event. If I then refresh the page or I change any filter/sorting the document becomes editable again. It seems to me that the CRUD looses the handler to the entity when I save it, but fetches it again on refresh.

Anyone have experience with MongoDB and CRUD? I would love to be pointed in the right direction here! See attached the DataProvider class.

Make sure that the equals/hashCode method of your changed object returns the same after you edited it

Thanks alot! That was the indeed the issue. I had used the lombok @EqualsAndHash annotation on the Customer class. One thousand internet points to you!