aspose file tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes I update database but how to refresh JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "I update database but how to refresh JTable" Watch "I update database but how to refresh JTable" New topic
Author

I update database but how to refresh JTable

Lisa Foster
Ranch Hand

Joined: Feb 28, 2001
Posts: 116
I am using AbstractTableModel
I update the database it works find but I have to manually do another search to see the new database available seats.
I try using model.fireTableDataChanged();
I need to refresh the Jtable manually when I book, but I would like it to do it asap when I book
help please
Thanks Lisa
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The assignment doesn't require for the clients view of the data to be in sync with the database.
If you want to update a row on your table, After you have updated the object collection in your abstract table model, call one of the following:
fireTableDataChanged();
fireTableRowsUpdated( index, index );
The sencond one should be better and more efficient if you'd like to update a single row only...
Hope this helps!!!
Benjam�n

[This message has been edited by Benjam�n Amodio (edited May 09, 2001).]
[This message has been edited by Benjam�n Amodio (edited May 09, 2001).]
ruilin yang
Ranch Hand

Joined: Feb 25, 2001
Posts: 334
I feel it is better to do a new search whenever you you need to display records since other user may have booked on the database. I assume you lock the database while you do the up-dating only.
If you just update you user interface without get information from the database, the display may not be a real presentation of the database. The information is not upto-date.
Therefore it makes more sense to do a new search everytime of the display.
Please Comment.
Ruilin
Lisa Foster
Ranch Hand

Joined: Feb 28, 2001
Posts: 116
I have to agree it makes alot of sense because the info can be deceptive to other onlookers if I just refresh the GUI good Point
Lisa
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: I update database but how to refresh JTable
 
Similar Threads
problem displaying jtable
JTable
question about my JTable
JTable question
JTable