[ rubbish-db ]

追記

このようにも書けます。

Book.findAny(Book.PUBLISHER.ge("04").and(Book.ID.between("001", "003")).order_by(Book.TITLE), new Handler() {
    public void handle(Book book) {
        println(book.getPublisher() + ": " + book.getTitle());
    }
});

ソース

Publisher publisher = Publisher.findByPK("01");
println(publisher);

publisher = Publisher.find("ID = ?", "01");
println(publisher);

Book[] books = Book.findAny(Book.PUBLISHER .eq("01"));

for (int i = 0; i < books.length; i++)
    println(books[i]);

Publisher.findAny(new ObjectHandler() {
    public void handle(Object row) {
        Publisher publisher = (Publisher) row;
        println(publisher.getId() + ": " + publisher.getName());
    };
});

Publisher[] publishers = Publisher.findAny(new MapHandler() {
    public void handle(Map conditions) {
        conditions.put(Publisher.VOLUMES, new Integer(4));
    };
});

for (int i = 0; i < publishers.length; i++)
    println(publishers[i]);

DatabaseManager.disconnect();

結果

connect database 'url=jdbc:hsqldb:hsql://localhost, user=sa, password='.
'SELECT * FROM PUBLISHER WHERE ID = ? [01]'
Publisher@{create_date=1999-07-10 17:10:00.000, id=01, name=栄学館, update_date=2005-07-10 17:10:00.000, volumes=4}
'SELECT * FROM PUBLISHER WHERE ID = ? [01]'
Publisher@{create_date=1999-07-10 17:10:00.000, id=01, name=栄学館, update_date=2005-07-10 17:10:00.000, volumes=4}
'SELECT * FROM BOOK WHERE PUBLISHER = ? [01]'
Book@{author=null, create_date=1999-06-10 17:10:00.000, id=000, issue_date=null, publisher=01, title=インド母なる大地を往く, update_date=2005-06-10 17:10:00.000}
Book@{author=null, create_date=1999-06-10 17:10:00.000, id=001, issue_date=null, publisher=01, title=騎馬民族の逆襲, update_date=2005-06-10 17:10:00.000}
Book@{author=null, create_date=1999-06-10 17:10:00.000, id=002, issue_date=null, publisher=01, title=中国武闘三千年, update_date=2005-06-10 17:10:00.000}
Book@{author=null, create_date=1999-06-10 17:10:00.000, id=003, issue_date=null, publisher=01, title=武家社会に於ける風俗・迷信, update_date=2005-06-10 17:10:00.000}
'SELECT * FROM PUBLISHER'
00: ミュンヒハウゼン出版
01: 栄学館
02: 時源出版
03: 曙蓬莱新聞社
04: 太公望書林
05: 日本曙蓬莱武術協会
06: 民明書房
'SELECT * FROM PUBLISHER  WHERE VOLUMES = ? [4]'
Publisher@{create_date=1999-07-10 17:10:00.000, id=01, name=栄学館, update_date=2005-07-10 17:10:00.000, volumes=4}
Publisher@{create_date=1999-07-10 17:10:00.000, id=02, name=時源出版, update_date=2005-07-10 17:10:00.000, volumes=4}
Publisher@{create_date=1999-07-10 17:10:00.000, id=03, name=曙蓬莱新聞社, update_date=2005-07-10 17:10:00.000, volumes=4}
disconnect database.