There is a simple entity that contains collection of another
private int id;
private String name;
private String secondName;
private Set<Document> documents = new HashSet()<Document>;
//getters and setters
For this two-level view, I'd consider two alternatives:
org.netbeans.swing.outline.Outline, shown here, would be an appealing choice.
JTable to display the master rows, and add a
ListSelectionListener that would update a second table's model to display the detail rows for the selected row in the master table. See User Selections for details.
Addendum: In your
TableModel, you can query the database in your implementation of
getValueAt(), as suggested in this example.