title: How to populate javafx tableview with a hashmap or any List instead of observable list in following format
body: <p>How can I just use a <code>List</code> , <code>ArrayList</code> or <code>HashMap</code> in the the observable list where it uses <code>&lt;Person&gt;</code> and every time a new <code>Person()</code> initialization and same for table column <code>PropertyValueFactory</code>.</p>
  
  <p>How can I just use :</p>
  
  <pre><code> private final ObservableList&lt;Person&gt; data =
      FXCollections.observableArrayList( MyList/HashMap/ArrayList Here);
  </code></pre>
  
  <p>I am having a tough time to figure out where I am making a mistake.</p>
  
  <p>Oracle docs give an example <a href="http://docs.oracle.com/javafx/2/ui_controls/table-view.htm" rel="nofollow">here</a></p>
  
  <pre><code>private TableView&lt;Person&gt; table = new TableView&lt;Person&gt;();
      private final ObservableList&lt;Person&gt; data =
          FXCollections.observableArrayList(
          new Person("Jacob", "Smith", "jacob.smith@example.com"),
          new Person("Isabella", "Johnson", "isabella.johnson@example.com"),
          new Person("Ethan", "Williams", "ethan.williams@example.com"),
          new Person("Emma", "Jones", "emma.jones@example.com"),
          new Person("Michael", "Brown", "michael.brown@example.com"));
  
  
  TableColumn emailCol = new TableColumn("Email");
      emailCol.setMinWidth(200);
      emailCol.setCellValueFactory(
          new PropertyValueFactory&lt;Person, String&gt;("email"));
  
      table.setItems(data);
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>      @FXML
        private TableView&lt;ObservableList&gt; tableViewCOA = new TableView&lt;ObservableList&gt;();
  
        @FXML
        private TableColumn superTypeNameCol = new TableColumn();
  
        @FXML
        private TableColumn catagoryNameCol = new TableColumn();
  
        @FXML
        private TableColumn accountNameCol = new TableColumn();
        @FXML
        private TableColumn accountIDCol = new TableColumn();
  
    final ObservableList&lt;ObservableList&gt; data = FXCollections.observableArrayList(
  
          getAllCOA() //&lt;-- myObservableListHere (refer to last method of jdbc)
  
            );
  
            superTypeNameCol.setCellValueFactory(
            new PropertyValueFactory&lt;COA,String&gt;("superNameCol")
                );
  
            catagoryNameCol.setCellValueFactory(
            new PropertyValueFactory&lt;COA,String&gt;("catagoryNameCol")
                );
            accountIDCol.setCellValueFactory(
            new PropertyValueFactory&lt;COA,String&gt;("accountIDCol")
                );
            accountNameCol.setCellValueFactory(
            new PropertyValueFactory&lt;COA,String&gt;("accountNameCol")
                );
  
            tableViewCOA.setItems(data);
  
    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */
    package accountsMain;
  
    import javafx.beans.property.SimpleStringProperty;
  
    /**
    *
    * @author u1
    */
    public class COA{
  
  
        private final SimpleStringProperty superNameCol;
        private final SimpleStringProperty catagoryNameCol;
        private final SimpleStringProperty accountNameCol;
        private final SimpleStringProperty accountIDCol;
  
  
        public COA(String superName,
            String catagoryName,
          String accountName,
          String accountID
  
            ){
  
  
        this.superNameCol   = new SimpleStringProperty(superName);
        this.catagoryNameCol  = new SimpleStringProperty(catagoryName);
        this.accountIDCol  = new SimpleStringProperty(accountID);
        this.accountNameCol   = new SimpleStringProperty(accountName);
  
        }
  
        public String getSuperNameCol() {
          return superNameCol.get();
        }
        public void setSuperNameCol(String superName) {
        superNameCol.set(superName);
        }
  
        public String getCatagoryNameCol() {
          return catagoryNameCol.get();
        }
        public void setCatagoryNameCol(String catagoryName) {
        catagoryNameCol.set(catagoryName);
        }
  
        public String getAccountIDCol() {
          return accountIDCol.get();
        }
        public void setAccountIDCol(String accountID) {
        accountIDCol.set(accountID);
        }
  
        public String getAccountNameCol() {
          return accountNameCol.get();
        }
        public void setAccountNameCol(String accountName) {
        accountNameCol.set(accountName);
        }
        }
  
    ///////////////////////////// this is what returns -----myObservableList-------///////////////////////////////
  
    public static ObservableList&lt;ObservableList&gt; getAllCOA() {
  
            Connection con = null;
  
        //    HashMap rows = new HashMap();
            ObservableList&lt;ObservableList&gt; rows = FXCollections.observableArrayList();
  
        try {
            Class.forName("com.mysql.jdbc.Driver");
            con = DriverManager.getConnection(
                "jdbc:mysql://"+host+":3306/"+DBname, user, password);
  
  
            PreparedStatement pStmt = con.prepareStatement(
          "select "
                + "supercoa.superTypeName,"
                + "catagorycoa.catagoryName,"
                + "accountscoa.accountName,"
                + "accountscoa.account_id"
                + " FROM"
                + " supercoa,catagorycoa,accountscoa"
                + " WHERE"
                + " accountscoa.catagory_id = catagorycoa.catagory_id"
                + " group by accountscoa.accountName");
  
            ResultSet rs = null;
            rs = pStmt.executeQuery();
            int i = 1;
            while (rs.next()) {
  
          //  List singleRow = new ArrayList();
            ObservableList&lt;String&gt; singleRow = FXCollections.observableArrayList();
            String supertypeName = rs.getString("supertypeName");  singleRow.add(supertypeName);
            String catagoryName = rs.getString("catagoryName");  singleRow.add(catagoryName);
            String accountName = rs.getString("accountName");  singleRow.add(accountName);
            String account_id = rs.getString("account_id");  singleRow.add(account_id);
  
            //rows.put(i,singleRow);
            //i++;
            rows.add(singleRow);
            }
  
            pStmt.close();
            con.close();
  
            } catch (ClassNotFoundException | SQLException e) {
            main.ErrorLogging.errorLog(e.toString());
  
            } 
          return rows;
        }
  </code></pre>
  
  <p>The data doesn't appears, but the table shows with blank columns</p>