views:

29

answers:

1

To respect requirements, I've temporarily used a hack to swap around a numerical id with a String representing a corresponding username in the view.

To do this I've called a DAO directly from a TableModel. Obviously, this isn't very elegant and is probably inappropriate from a design point of view. What would be the proper approach to achieve this?

+1  A: 

A TableModel is queried from the EDT and so should never block - so calling a DAO is probably a bad idea. You can either:

  1. Retrieve the information you need from the DAO and provide it to the TableModel prior to showing your table.
  2. Dynamically load the information in the background and add it to the TableModel when the data access has completed.

1 is probably the easiest option to implement.

Russ Hayward