JAVAFX 8 ComboBox and ObservableList
<p>I need a combobox populated through observablelist which contains specific data retrieved from DB. This is my source.</p>

<p>Model</p>

<pre><code>public ObservableList&lt;Bank&gt; listBank = FXCollections.observableArrayList();

public static class Bank {
            private final StringProperty id;
            private final StringProperty name;

            private Bank(
                    String id, 
                    String name
            ) {
            this.id = new SimpleStringProperty(id);
            this.name = new SimpleStringProperty(name);        
            }

            public StringProperty idProperty() { return id; }
            public StringProperty nameProperty() { return name; }        
        }
</code></pre>

<p>View</p>

<pre><code>@FXML
private ComboBox comboBank&lt;Bank&gt;;

public final void getBankDataFields() {
        comboBank.setItems(model.listBank); 
    }

comboBank.setButtonCell(new ListCell&lt;Bank&gt;() {
                @Override
                protected void updateItem(Bank t, boolean bln) {
                    super.updateItem(t, bln);
                    if (t != null) {
                        setText(t.nameProperty().getValue().toUpperCase());
                    } else {
                        setText(null);
                    }
                }
            });

comboBank.setCellFactory(new Callback&lt;ListView&lt;Bank&gt;, ListCell&lt;Bank&gt;&gt;() {
                @Override 
                public ListCell&lt;Bank&gt; call(ListView&lt;Bank&gt; p) {
                    return new ListCell&lt;Bank&gt;() { 
                        @Override
                        protected void updateItem(Bank t, boolean bln) {
                            super.updateItem(t, bln);
                            if(t != null){
                                setText(t.nomeProperty().getValue().toUpperCase());
                            } else {
                                setText(null);
                            }    

                        }                       
                    };
                }
            });

comboBank.valueProperty().addListener((ObservableValue&lt;? extends Bank&gt; observable, Bank oldValue, Bank newValue) -&gt; {
                setIdBank(newValue.idProperty().getValue());
            });
</code></pre>

<p>ComboBox is populated with NAME field and listener is used to get relative ID and pass it to a query for storing data on DB.</p>

<p>Ok, everything seems to work but i have two questions:</p>

<ol>
<li><p>When user need to modify this record, i need to get the ID from DB and select the relative NAME in ComboBox. How can i do that?</p>

<p>comboBank.setValue(????);</p></li>
<li><p>Is there a better way to achieve this goal? An ObservableMap may substitute the ObservableList?</p></li>
</ol>

<p>Thanks in advance.</p>