Pass an object inside another to a Tablelist

Asked

Viewed 14 times

0

When trying to make an outline of my first program I realized that I need to pass to a Tablelist an object within another, I could not understand why Tablelist is not accepting to receive an object of the Patient type that is within my query. Follows the code:

    @FXML private TableView<ConsultaVO> tabelaConsulta;
    @FXML private TableColumn<ConsultaVO, Integer> ide;
    @FXML private TableColumn<PacienteVO, String> nome;
    @FXML private TableColumn<PacienteVO, String> cpf;
    @FXML private TableColumn<PacienteVO, String> sangue;
    @FXML private TableColumn<PacienteVO, String> genero;
    @FXML private TableColumn<PacienteVO, Float> peso;
    @FXML private TableColumn<PacienteVO, Float> altura;

    ObservableList<ConsultaVO> consulta = FXCollections.observableArrayList(bo.listar());
    ide.setCellValueFactory(new PropertyValueFactory<ConsultaVO, Integer>("id"));
    nome.setCellValueFactory(new PropertyValueFactory<PacienteVO, String>("nome"));
    cpf.setCellValueFactory(new PropertyValueFactory<ConsultaVO, String>("cpf"));
    sangue.setCellValueFactory(new PropertyValueFactory<PacienteVO, String>("tipoSangue"));
    genero.setCellValueFactory(new PropertyValueFactory<PacienteVO, String>("genero"));
    peso.setCellValueFactory(new PropertyValueFactory<PacienteVO, Float>("peso"));
    altura.setCellValueFactory(new PropertyValueFactory<PacienteVO, Float>("altura"));
    tabelaConsulta.setItems(consulta);

I’m popping the Resultset data correctly.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.