Combobox/Dataprovider usage

Hi !

I am trying to bind combobox to a data provider created with DataProvider.fromFilteringCallbacks
This all works brilliantly.

However what i can’t seem to figure out is how to select the first item in the combobox so that it is never in an
empty state at initialization time…

All the examples i’ve seen so far use setItems with some in memory collection, but mine is bound to a dataprovider that
fetches from a spring repository lazily.

Answering my own question, in the case someone else might need it:

Make sure your dataprovider override getId and returns the primary key of your entities…
You can then just retrieve a new copy of the entity via whatever method and assign it with setValue
Even though those would likely be different instances, vaadin uses the primary key now for equality comparison.