Какое программное обеспечение Linux/Unix использовать для преобразования HTML или PDF к документу?

Кажется, что вам нужно @UseRowReducer

Реализация для вашего примера будет выглядеть примерно так:

@SqlQuery("SELECT a." + AUTHOR_COLUMN MAMES + ", b." + BOOK_COLUMN_NAMES + " FROM authors as author" +
  " LEFT JOIN books AS book" +
  " ON author.id = book.authorId" +
  " WHERE id = :authorId")
@RegisterBeanMapper(value = Book.class, prefix = "b") 
@RegisterBeanMapper(value = AuthorWithBooks.class, prefix = "a")
@UseRowReducer(AuthorBookReducer.class) 
List getAuthorWithBooks(@Bind("authorId") int authorId);

class AuthorBookReducer implements LinkedHashMapRowReducer { 
    @Override
    public void accumulate(Map map, RowView rowView) {
        Author author = map.computeIfAbsent(rowView.getColumn("a_id", Integer.class), 
                                       id -> rowView.getRow(Author.class));

        if (rowView.getColumn("b_id", Integer.class) != null) { 
            author.getBooks().add(rowView.getRow(Book.class));
        }
    }
}

6
задан 12 February 2009 в 17:12
поделиться