In javafx I have created a some buttons and a TableView
with some columns.
when I click the button, it adds the product into TableView
columns.
so far, no problem with that.
I have created a Product
class and using this I create a product object with pID, pName, pQty, pPrice
.
example:
new Product(1, "Pen", 2, 3.50);
new Product(2, "notebook", 1, 5.00);
so whenever I click a product button it adds this product in next row.
Here is the problem I face:
I want to add all these rows in TableView
to database I have created.
Is there a method to get all these objects one by one from TableView
and insert it to database?
Or is there a method to populate database from ObservableList
?
Here is my solution. Actually I was so stupid as I was keep trying to insert all these data into another database and table with the same names. So, basically no problem of inserting. sorry for the inconvenience. and Thanks for everyone who is interested. Also, I am putting here the code I used for insertion. In case it could be useful for someone.
I have put this inside for loop, this way I was able to iterate each object member.