[ rubbish-db ]

ソース

RubbishDatabase dbh = new RubbishDatabase();
dbh.setLogging(true);

dbh.connect("jdbc:hsqldb:hsql://localhost", "sa", "");

Class[] types01 = { Publisher.class, Book.class };
JoinedSel sel01 = new JoinedSel(types01, "PUBLISHER.ID=:id ORDER BY BOOK.ID");
sel01.put("id", "04");
Map[] jtabs01 = dbh.select(sel01);

for (int i = 0; i < jtabs01.length; i++) {
    Publisher publisher = (Publisher) jtabs01[i].get(Publisher.class);
    Book book = (Book) jtabs01[i].get(Book.class);
    println(publisher.getName() + ", " + publisher.getUpdate_date() + " / " + book.getTitle() + ", "
            + book.getUpdate_date());
}

Map types02 = new HashMap();
types02.put("PU", Publisher.class);
types02.put("BO", Book.class);
JoinedSelM sel02 = new JoinedSelM(types02, "PU.ID=BO.PUBLISHER AND PU.ID=:id ORDER BY BO.ID");
sel02.put("id", "04");
Map[] jtabs02 = dbh.select(sel02);

for (int i = 0; i < jtabs02.length; i++) {
    Publisher publisher = (Publisher) jtabs02[i].get(Publisher.class);
    Book book = (Book) jtabs02[i].get(Book.class);
    println(publisher.getName() + ", " + publisher.getUpdate_date() + " / " + book.getTitle() + ", "
            + book.getUpdate_date());
}

dbh.disconnect();

結果

connect database 'url=jdbc:hsqldb:hsql://localhost, user=sa, password='.
'SELECT PUBLISHER.CREATE_DATE, PUBLISHER.ID, PUBLISHER.NAME, PUBLISHER.UPDATE_DATE, PUBLISHER.VOLUMES, BOOK.AUTHOR, BOOK.CREATE_DATE, BOOK.ID, BOOK.ISSUE_DATE, BOOK.PUBLISHER, BOOK.TITLE, BOOK.UPDATE_DATE FROM PUBLISHER, BOOK WHERE PUBLISHER.ID=BOOK.PUBLISHER AND PUBLISHER.ID=? ORDER BY BOOK.ID [04]'
太公望書林, 2005-07-10 17:10:00.000 / あなたにも出来る!中国拳法修行百科, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / エーゲ海-古代格闘史の浪漫-, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / ギリシャ神話に見る現代人への教訓, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / シルクロードの彼方, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 暗黒組織類聚, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 英国貴族の習慣・風俗, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 眼球大脳生理学, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 世界幻覚大全, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 世界残虐刑罰史, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 世界頭髪大全, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 中国拳法-火の考察-, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 動物棲息類聚, 2005-06-10 17:10:00.000
'SELECT BO.AUTHOR, BO.CREATE_DATE, BO.ID, BO.ISSUE_DATE, BO.PUBLISHER, BO.TITLE, BO.UPDATE_DATE, PU.CREATE_DATE, PU.ID, PU.NAME, PU.UPDATE_DATE, PU.VOLUMES FROM BOOK BO, PUBLISHER PU WHERE PU.ID=BO.PUBLISHER AND PU.ID=? ORDER BY BO.ID [04]'
太公望書林, 2005-07-10 17:10:00.000 / あなたにも出来る!中国拳法修行百科, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / エーゲ海-古代格闘史の浪漫-, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / ギリシャ神話に見る現代人への教訓, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / シルクロードの彼方, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 暗黒組織類聚, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 英国貴族の習慣・風俗, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 眼球大脳生理学, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 世界幻覚大全, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 世界残虐刑罰史, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 世界頭髪大全, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 中国拳法-火の考察-, 2005-06-10 17:10:00.000
太公望書林, 2005-07-10 17:10:00.000 / 動物棲息類聚, 2005-06-10 17:10:00.000
disconnect database.