• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to save the changes in db through JTable

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.
I have a JTable with 100 or more rows. What i need is that the user should select the row and click the button delete. Then the row from database must also be deleted. One more thing i want to know is that how can i save the changes made in JTable in the database. I need a little help.



Thanks and Regards
alexander
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Adeeb,

Are you using a cache (memory) of the data? If so, when you click delete button, you trigger the table model to remove that row or object from the data. At the same time, the table model through some means delete the physical database table row then fireXXX() methods.

If no cache, then the table model deletes the physical database table row and refresh the view using fireXXX() methods.

Of course you would need a action listener for the delete button to trigger the appropriate method in the table model.

All this depends on where you are doing the actual modification, backend (some service layer between db and client) or directly in the table model class (front end).
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tsang.
I am using just the default table model. just like this



Now where and what should i change or add to get the work done.

Thanks.>
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic