| |
Main.java
import java.sql.*;
import java.util.*;
import generated.*;
public class Main {
public static void main(String[] args)
{
try
{
MasterDetailService service=new MasterDetailServiceImpl();
// get the master list
List<MasterBean> masterBeanList=service.getMasterList();
// get the map to the detail lists
Map<String,List<DetailBean>> detailMap=service.getDetailMap();
for (MasterBean m : masterBeanList)
{
System.out.println( m.getArtist() + " / " + m.getAlbum() );
for ( DetailBean d : detailMap.get(m.getId()) )
{
System.out.println(d.getTrackno() + ": " + d.getTitle() );
}
System.out.println();
}
}
catch(SQLException e)
{
System.err.println("SQLException: " + e.getMessage());
}
}}
|