Search Picker / Lookup Picker with recommendation instead of reference


i’ve a question about the searchPicker field component (or maybe about any ui component that will fulfill the request). What i’d like to achieve is that although there is a reference to another object actually i just want to persist a String of the reference, not a ID to another column.

Here’s a use case for this feature:
“When i create a customer in a customer editor i want to select a title in the form of the customer. There should be certain pre-defined values, but if i want to add custom things to the title in case the searched term is not in the list of available titles”

I attached a sample project. Instead of having a entity reference, i want to store a attribute “title” in the customer class with the type “String”.

So basically i just want to have some kind of suggestion, but not a reference.

To solve this i found this example:
as well as:

But i’m not really sure how to solve this. I hope i explained my issue well.

Perhaps you have an idea on how to solve this.

Mario (34.8K)

1 Like

Hi Mario,

CUBA does not support this mode for SearchPickerField and it is out of scope of this component.

I would recommend to integrate third-party Vaadin add-on: AutocompleteTextField!addon/autocompletetextfield-add-on It seems that it is suitable for your task.

You can integrate it to your application using Studio:

Hi Yuiry,

thanks for the answer. In case i would use a generic autocomplete picker, i’ll lose the additional opportunity to make a lookup that is possible in the PickerField in case i’m not really sure what i’m searching for, right?


Yes, but you can add standalone action buttons next to the field.

Hi @mario,

Did you finally used the vaadin addon ? How you implemented it in order to execute SQL queries ?