PDA

View Full Version : Database to GlazedList/Jtable and then edit the database through the GlazedList/JTabl


twodayslate
01-29-2010, 11:56 AM
I am able to break this problem down into two questions:


What is the best way to put the contents of a database (MS-Access) into a GlazedList (http://www.publicobject.com/glazedlists/)/JTable (http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTable.html)?
How do I make sure any changes made to the GlazedList (http://www.publicobject.com/glazedlists/)/JTable (http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTable.html) are reflected on the database (MS-Access)?


Here are the things I know:


I know how to retrieve/manipulate the information from a database using the JDBC method (http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2691&lngWId=2).
I know that GlazedList's require reflection so I would need to make a class that contains every column/field in the database. This is not very expandable...


What is the best way to go about this problem?

I have managed to create a class generator. It takes the column headings and creates an instance field. I'll post the code in a bit. This should resolve the #2
edit:// http://pastebin.ca/1770996 - It creates the class but I do not think I used reflection correctly...

twodayslate
02-03-2010, 06:13 AM
I edited my code so it works.

http://pastebin.ca/1776722


Now I am pretty sure I just need to make sure the db stores any changes