private void updateTableView(){ Thread threadConnectingToDB = new Thread(() -> { try { Listpatients; PatientDAO patientDAO = FactoryDAO.getInstance().getPatientDAO(); if(patientDAO.getAllPatients() instanceof List){ patients = (List) patientDAO.getAllPatients(); } else { patients = new ArrayList(patientDAO.getAllPatients()); } columnID.setCellValueFactory(new PropertyValueFactory ("id")); columnDate.setCellValueFactory(new PropertyValueFactory ("doc_date")); columnDate.setCellFactory(column -> { TableCell cell = new TableCell () { private SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy"); @Override protected void updateItem(Date item, boolean empty) { super.updateItem(item, empty); if(empty) { setText(null); } else { if(item != null) this.setText(format.format(item)); } } }; return cell; }); columnSecondname.setCellValueFactory(new PropertyValueFactory ("secondname")); columnFirstname.setCellValueFactory(new PropertyValueFactory ("firstname")); columnThirdname.setCellValueFactory(new PropertyValueFactory ("thirdname")); tableView.setItems(FXCollections.observableList(patients)); } catch (SQLException e) { try { ErrorStage.display("Произошла ошибка при подключении к базе данных"); } catch (Exception e1) { e1.printStackTrace(); } e.printStackTrace(); } }); threadConnectingToDB.start(); threadConnectingToDB.interrupt();}