Confused on how to Bind Multi-Select Options to a JPA Entity with a @ManyToOne Relationship?

Currently, I am trying to make a multiselect of type Tool
MultiselectComboBox<Tool> select = new MultiselectComboBox<Tool>();

I have a File entity, and in the UI, there is a table where each row represents a File. This table has a column called tool.

I decided to remove the tool column from the database, but the tool column will still be shown in the UI. The tool column has changed from a single-select to a multi-select field.

I created a separate database table for tool, which has fields for name and type, and a @ManyToOne relationship with the File entity. The Tool table has a foreign key that maps to the primary key of the File entity.

In the UI, the available select options for the tool are provided by an external service, which returns a list of strings. I need to bind these selected strings so that they can be maped to my Tool table. For example, if a user selects options a, b, and c, my Tool table should have three rows of data, each with the name and the File ID.

I am unsure how to perform this binding. Can I get some guidance?

Value type of all Vaadin multiselections is Set<T>. If your property of the field is not of Set type, e.g. List, then you need to use ListSet converter in your binding.