Populating Jtable from database - better way?
I have a table in MySQL database.
Is there a way where I can populate a JTable with values from a java bean obnject, which would be getting the values from MySQL table.
Say I have a table named EMPLOYEE with the following details:
6. Phone Number
and my Java bean class is Employee which has the following member variables
And my JTable should display only the 4 columns out of 6 from MySQL table.
Also I want the table to be auto-refreshed.. the data should be checked for updation.
Which is the best way to do it from the following:
1. Directly read the values from the table using JDBC connection and populate the values into the JTable and poll it using a timer
2. Read the values into a java bean and use a table model to display those values.
Is there any better way to do it?
I am new to Swing so I am unaware of the performance issues related to it.
Would be very thankful for guiding.
Thanks in adavnce.