Question about binding OptionGroup (multiselect) to a String in csv format

Hello all,

I am new to Vaadin, and while I am getting better at this, it’s been rather frustrating at times. This time, I am looking at a problem that I am not at all sure if I am moving in the right direction to solve this problem.

I have an OptionGroup with multiselect. I’d like to bind selected options to a String value (in csv format ultimately), so that I can insert that value into a single column. I understand this may not look or sound like an effective way to do things, but it’s the way this problem needs to be solved at this point.

So, my questions are listed below.

  1. Is it okay to directly bind aforementioned OptionGroup to a String member field? If so, in what form does selected options get stored (or bound) in this member?

  2. If I’d like to turn the selected options into csv, then save it to the String field member, could I even use bind? After all, the value of the String member field will be inserted into DB, so it ought to contain csv String. Yet, I’d like to find (if it’s possible in the first place) a way to bind selections from this OptionGroup to this field member.

I am not sure if I described my problem well. This actually may confuse those who are willing to give me advice, I suppose. Anyways, if there is any advice you could give me to approach this problem from the right angle (even if it’s not a solution), I’d really appreciate your help.

I think you can do this with a com.vaadin.data.util.converter.Converter<java.util.Set,String>

The Converter should change the property value ( a String ) to a set of Strings and vice versa.

NOTE : I have not tested this…