Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 587429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:12:40+00:00 2026-05-13T15:12:40+00:00

I am able to break this problem down into two questions: What is the

  • 0

I am able to break this problem down into two questions:

  1. What is the best way to put the contents of a database (MS-Access) into a GlazedList/JTable?
  2. How do I make sure any changes made to the GlazedList/JTable are reflected on the database (MS-Access)?

Here are the things I know:

  1. I know how to retrieve/manipulate the
    information from a database using
    the JDBC method.
  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?

edit:// I have managed to create a class generator. It takes the column headings and creates an instance field. This should resolve the #2
http://pastebin.ca/1770996 – It creates the class but I do not think I used reflection correctly…
edit2:// Edited my code from above so it works… http://pastebin.ca/1776722

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:12:41+00:00Added an answer on May 13, 2026 at 3:12 pm

    I had a very similar problem, and I think my result was similar too, except it didn’t need reflection (static DB schema). You need to create row objects for each row (which may just include row number and references to a ResultSet and column info).

    Then write a ca.odell.glazedlists.gui.WritableTableFormat implementation to map these objects to table cells.

    To avoid problems with #2, you can create a flexible row class that fetches column info once from the ResultSet and caches it for reuse.

    Edit: I found an original and simpler implementation (fairly simple) that mine was based upon. You can view it here: ResultSet Table. It might be sufficient for your purposes. Then you add this to the AbstractTableModel implementation provided by the link.

    public void setValueAt(Object ob, int row, int column) throws SQLException {
        resultSet.absolute(r+1);
        if (ob == null) {
            resultSet.updateNull(column+2);
        } else {
            resultSet.updateObject(column+2,ob);
        }
        rs.updateRow();
        this.fireTableCellUpdated(row,column);  
    }
    public boolean isCellEditable(int row, int col) {
        return true;
    }
    

    There are three catches though: your ResultSet needs to be updatable, support scrolling both directions, and be sensitive to updates to the DB. These are part of the JDBC spec, but not all drivers support them, and you need to make sure your ResultSet is created with them enabled. In that case, you just do this.fireTableDataChanged() periodically to force a full update of the table data. It’s not the fastest approach, but it does work.


    Edit2: Another approach

    What about using one of the Object-relational mapper libraries, and then do the ca.odell.glazedlists.gui.WritableTableFormat like I suggested above?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.