my dog learned polymorphism*
The moose likes JDBC and the fly likes storing values from JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "storing values from JTable" Watch "storing values from JTable" New topic
Author

storing values from JTable

Jay Albano
Greenhorn

Joined: May 07, 2004
Posts: 21
hey there guys! i've got a problem here... i don't know how to store/save the values from the changes i've made in the table after retrieving information from the database to that table. need some help guys/gals!!!


Trust in the Lord with all thine heart and lean not unto thine own understanding, <br />in all thy ways acknowledge Him and He shall direct thy path.<br /> <br />blue jay´┐Ż
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

Jay,
Are you asking how to get the changes from the JTable or how to update the database to the new values once you have them or both?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jay Albano
Greenhorn

Joined: May 07, 2004
Posts: 21
yep... a little scenario goes like this...
there are already values stored in my database. these values are then retrieved and viewed using the JTable. after being viewed in the table, changes are allowed... the problem goes here, how can i make any updates in part or whole (as it depends on the situation) of the JTable entries to my database and still refer to those same locations?
if anything's still unclear, feel free to remind me,... thanks! ;-}
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
Are you asking about how to update the changed values in Database? If you display all the records from the DB table and allow the user to edit anyone including the primary key of the table then it will be difficult to update the record in the table. If there is a situation that you should allow all the values to updated by user then define a serial no of any number in table which will not be changed and every record will be updated against that serial no column. Your table would be something like following

SerialNO Col1 Col2 Col3
1 val val val
2 val val val

Now every record is against a spcific unique serial no so you can use that no while updating the records. I don't know JTable but you can store this serial no against each record in any hidden field or something else.

If i misunderstood the problem then expalin.
Jay Albano
Greenhorn

Joined: May 07, 2004
Posts: 21
sorry if there's any misconception...anywayz, lets put it this way.

i have a database with some values on it... these values are then displayed in an application using JTable. changes are applicable in this JTable since it is 'setEnabled(true)'. if i were to make changes on this JTable, the problem goes here...

> how to make one field of it uneditable for the sake of the primary key,
> how to retrieve these values from the JTable,
> and after being retrieved (as assumed), how do i store it back to the database (updating the database)

im like gettin' confused in using JTable but it seems the better way in dislaying data from the database in terms of multiple entries.
thanks... for the clarrification. GBU! (",)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: storing values from JTable
 
Similar Threads
Rendering dates from long values in JTable
combobox ,how to get it from Table
image resizing
Hibernate: Optimization: id generation & two step insert
Problems with table data manipulation (STRIPES)