title: Showing two tables content in one table. Binding. JavaFX
body: <p>I have two tables which are mapped and linked (PositionResource and PositionCurrency), I want to bind them in one table, so that two columns are from one table and one column from another. I've done this work:</p>
  
  <pre><code>    @FXML
      private TableView&lt;PositionResource&gt; tv_loro_nostro_accounts;
      @FXML
      private TableColumn&lt;PositionResource, String&gt; tc_account;
      @FXML
      private TableColumn&lt;PositionResource, String&gt; tc_acc_name;
      @FXML
      private TableColumn&lt;PositionCurrency, String&gt; tc_currency;
  </code></pre>
  
  <p>and binding is as follows. Relation is one to many (one PositionCurrency can have many PositionResource)</p>
  
  <pre><code>tc_account.setCellValueFactory(cellData -&gt; new SimpleStringProperty(cellData.getValue().getBrief()));
  tc_acc_name.setCellValueFactory(cellData -&gt; new SimpleStringProperty(cellData.getValue().getName()));
  tc_currency.setCellValueFactory(cellData -&gt; new SimpleStringProperty(cellData.getValue().getBrief()));
  </code></pre>
  
  <p>Exception is:</p>
  
  <blockquote>
    <p>Exception in thread "JavaFX Application Thread" java.lang.ClassCastException:   ru.com.isbank.adc.adc_common.model.position.PositionResource cannot be cast to ru.com.isbank.adc.adc_common.model.position.PositionCurrency</p>
  </blockquote>