title: Error when no constructor method and error when constructor method
body: <p>im having a problem with my tableview. whenever i add a item to my database, it appears on my tableview, but only after i close and reopen the tableview. However i'd like to have added to my tableview immediately after having it added. So i made a refresh method, but im getting error from there. I have added comments to my code, which explains where the problem occurs.</p>
  
  <p>I have removed imports and @FXML tags</p>
  
  <pre><code>package packet;
  
  
  
  public class DataControll implements Initializable {
  
  
  
      private static Connection con;
      private static Statement stat;
      private PreparedStatement prep;
      ResultSet rs = null;
  
      private ObservableList&lt;Toidubaas&gt; toidudata;
  
      public void eemaldaListist() {
  
      }
  
      public void lisaNupp(ActionEvent event) {
  
          try {
              String query = "INSERT OR IGNORE INTO Toiduinfo (Toidu, Kalorid, Valgud, Süsivesikud, Rasvad) VALUES(?, ?, ?, ?, ?)";
              prep = con.prepareStatement(query);
  
              prep.setString(1, lisaToit.getText());
              prep.setInt(2, Integer.parseInt(lisaKcal.getText()));
              prep.setInt(3, Integer.parseInt(lisaValk.getText()));
              prep.setInt(4, Integer.parseInt(lisaSysi.getText()));
              prep.setInt(5, Integer.parseInt(lisaRasv.getText()));
              prep.execute();
              prep.close();
          } catch (Exception er) {
              System.out.println(er.getMessage());
          }
  
          clearForm();
      }
  
      private void clearForm() {
          lisaToit.clear();
          lisaKcal.clear();
          lisaValk.clear();
          lisaSysi.clear();
          lisaRasv.clear();
      }
  
      @Override
      public void initialize(URL url, ResourceBundle rb) {
          toidudata = FXCollections.observableArrayList();
  
          tbCal.setCellValueFactory(new PropertyValueFactory&lt;Toidubaas, Integer&gt;("rbCal"));
          tbProt.setCellValueFactory(new PropertyValueFactory&lt;Toidubaas, Integer&gt;("rbProt"));
          tbCarb.setCellValueFactory(new PropertyValueFactory&lt;Toidubaas, Integer&gt;("rbCarb"));
          tbFat.setCellValueFactory(new PropertyValueFactory&lt;Toidubaas, Integer&gt;("rbFat"));
          tbMeal.setCellValueFactory(new PropertyValueFactory&lt;Toidubaas, String&gt;("rbMeal"));
  
  
  
          try {
  
              con = DriverManager.getConnection("jdbc:sqlite:Fooditabel.sqlite");
              stat = con.createStatement();
              stat.executeUpdate(
                      "CREATE TABLE IF NOT EXISTS Toiduinfo (Toidu TEXT, Kalorid INTEGER, Valgud INTEGER, Süsivesikud INTEGER, Rasvad INTEGER)");
  
              ResultSet rs = con.createStatement()
                      .executeQuery("SELECT Toidu, Kalorid, Valgud, Süsivesikud, Rasvad FROM Toiduinfo");
              while (rs.next()) {
                  Toidubaas nt = new Toidubaas(); //if i add constructor method, im getting error here, saying the constructor is undefined
  
                  nt.rbMeal.set(rs.getString("Toidu"));
                  nt.rbCal.set(rs.getInt("Kalorid"));
                  nt.rbProt.set(rs.getInt("Valgud"));
                  nt.rbCarb.set(rs.getInt("Süsivesikud"));
                  nt.rbFat.set(rs.getInt("Rasvad"));
                  toidudata.add(nt);
              }
  
              tbTabelview.setItems(toidudata);
  
          } catch (SQLException ex) {
              System.out.println(ex.getMessage());
              ;
          }
      }
  
      public void refreshTable() {
          toidudata.clear();
          try {
              String query = "Select * FROM Toiduinfo";
              prep = con.prepareStatement(query);
              rs = prep.executeQuery();
  
              while (rs.next()) {
                  toidudata.add(new Toidubaas(     //Getting error here, if im not using constructor method, saying the method is undefined.
                     rs.getString("Toidu"),
                     rs.getInt("Kalorid"), 
                     rs.getInt("Valgud"),
                     rs.getInt("Süsivesikud"), 
                     rs.getInt("Rasvad")));
                  tbTabelview.setItems(toidudata);
              }
              prep.close();
          } catch (Exception e2) {
  
          }
      }
  }
  </code></pre>
  
  <p>and here is the class with constructor method. Please note that constructor method is commented out, so my program would populate tableview with database data.</p>
  
  <pre><code>public class Toidubaas {
  
      public  SimpleIntegerProperty rbCal = new SimpleIntegerProperty();
      public  SimpleIntegerProperty rbProt = new SimpleIntegerProperty();
      public  SimpleIntegerProperty rbCarb = new SimpleIntegerProperty();
      public  SimpleIntegerProperty rbFat = new SimpleIntegerProperty();
      public  SimpleStringProperty rbMeal = new SimpleStringProperty();
  
  //This is the constructor method
  
        /*public Toidubaas(String sbMeal, Integer sbCal, Integer sbProt, Integer sbCarb, Integer sbFat) {
  
          this.rbMeal = new SimpleStringProperty(sbMeal);
          this.rbCal = new SimpleIntegerProperty(sbCal);
          this.rbProt = new SimpleIntegerProperty(sbProt);
          this.rbCarb = new SimpleIntegerProperty(sbCarb);
          this.rbFat = new SimpleIntegerProperty(sbFat);
  
      }*/
  
      public String getRbMeal() {
          return rbMeal.get();
      }
  
      public void setRbMeal(String v) {
          rbMeal.set(v);
      }
  
      public Integer getRbCal() {
          return rbCal.get();
      }
  
      public void setRbCal(Integer v) {
          rbCal.set(v);
      }
  
      public Integer getRbProt() {
          return rbProt.get();
      }
  
      public void setRbProt(Integer v) {
          rbProt.set(v);
      }
  
      public Integer getRbCarb() {
          return rbCarb.get();
      }
  
      public void setRbCarb(Integer v) {
          rbCarb.set(v);
      }
  
      public Integer getRbFat() {
          return rbFat.get();
      }
  
      public void setRbFat(Integer v) {
          rbFat.set(v);
      }
  
  
  
  }
  </code></pre>