In the following code i am trying to populate data from database into tableview using MVC architecture. I am getting a complete row in each column which is not my requirement.
I want to populate tableview with database table as it is.Same code is working fine without MVC architecture in javafx.Please consider the following code.
first of all you should think about concurrency issues. You are calling the sql statement on the JavaFX Application Thread. Because it could take some time to call the statement the application thread can't handle user interaction or repaint the ui. In this case the application is frozen. Maybe you can check DataFX (www.javafxdata.org) because it handles this issues.
About your problem:
With "col.setCellValueFactory" you define a cell value factory for a column. This factory will extract the item for the column from a data item of the table. The CellDataFeatures that is passed to the lambda expression contains the data item for the current row that is defined by TableView.getItems(). In your example you always return the value (the complete data item). Therefore each cell contains the data item that is defined for the row.