• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to save a table model to a database and how do you know it is dirty?

 
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Changed my mind.
How would I do these things?
1) save a table model into the database after clicking on a button
2) how do you know that the table model is dirty? (has been changed)
Thanks
Jack
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jack Luk wrote:How would I do these things?
1) save a table model into the database after clicking on a button


Well, you know your model. So, read through the model (say iterate) and make JDBC calls to take appropriate action.

Jack Luk wrote: 2) how do you know that the table model is dirty? (has been changed)


You need to listen to table model changes via TableModelListener.
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ranganathan Kaliyur Mannar wrote:

Jack Luk wrote:How would I do these things?
1) save a table model into the database after clicking on a button


Well, you know your model. So, read through the model (say iterate) and make JDBC calls to take appropriate action.

Jack Luk wrote: 2) how do you know that the table model is dirty? (has been changed)


You need to listen to table model changes via TableModelListener.



One thingy strange is that when I follow this sample


I set a bp inside tableChanged, my Event handler bp was never hit.
I will prepare another test set tomorrow.
Thanks
Jack
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://docs.google.com/open?id=0Byu1vVqeMEJ5NjF1OG9uLUdRLWM

You'll notice that valueChanged occurs before I make changes to the cell
in another way, if I use tablelistener, the tableChanged event was never triggered

Thanks
Jack
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jack Luk wrote:I set a bp inside tableChanged, my Event handler bp was never hit.


I have no idea what 'bp' means. Can you explain?
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ranganathan Kaliyur Mannar wrote:

Jack Luk wrote:I set a bp inside tableChanged, my Event handler bp was never hit.


I have no idea what 'bp' means. Can you explain?



bp == breakpoint. Sorry for the abbreviation
Thanks
Jack
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, then you need to provide code for us in the form of SSCCE which reproduces the problem.
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ranganathan Kaliyur Mannar wrote:Ok, then you need to provide code for us in the form of SSCCE which reproduces the problem.



https://docs.google.com/open?id=0Byu1vVqeMEJ5bm1TSFFCQUJJTFk

The source code has been reduced to a only a few methods. about 54K, in which 30K is the form and inevitable
Let me know
Thanks
Jack
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
54K is not a short self contained, correct example. And with all the separate files I'm not sure I would call it self contained either.
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic