title: Combine Javafx Progress Bar with method for loading data
body: <p>I have a method which loads data from db using Hibernate connection. I want to add to this method - progress bar - for showing when loading data will end.</p>
  
  <p>this is my method for loading data:</p>
  
  <pre><code>    @FXML
      private JFXProgressBar progressBar;
  
      @FXML
      private JFXTextArea textArea;
  
      @FXML
          void executeQuery(MouseEvent event) {
              //LOAD DATA FROM DB USING HIBERNATE AND SET TEXT TO TEXTAREA
              EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("firebird_config_file");
              EntityManager entityManager = entityManagerFactory.createEntityManager();
  
              TypedQuery&lt;Programy&gt; query1 =  entityManager.createQuery("select p from Programy p", Programy.class);
              String resultOfTheQuery="";
              for (Programy programy  : query1.getResultList() ) {
                  String tmp= "Nazwa programu: " + programy.getExeNazwa() + " Kod programu: " + programy.getKodProg()+" Wersja: "+programy.getWersja()+"\n";
                  resultOfTheQuery+=tmp;
              }
              textArea.setText(resultOfTheQuery);
          }
  </code></pre>
  
  <p>this is screenshot from my scene (i am using fxml files):
  <a href="https://i.stack.imgur.com/q2CGD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q2CGD.jpg" alt="enter image description here"></a></p>