author = new Author();
author.setName("NotCorrespondingName");
author.save();
Book book = new Book();
book.setTitle("Name");
book.setAuthor(author);
book.setIsbn("unknown");
book.save();
Criteria criteria = new Criteria();
criteria.addJoin(BookPeer.TITLE, AuthorPeer.NAME);
BookPeer.addSelectColumns(criteria);
AuthorPeer.addSelectColumns(criteria);
// basically a BaseBookPeer.setDbName(criteria);
// and BasePeer.doSelect(criteria);
CompositeMapper mapper = new CompositeMapper();
mapper.addMapper(new BookRecordMapper(), 0);
mapper.addMapper(
new AuthorRecordMapper(),
BookPeer.numColumns);
List<List<Object>> queryResult
= BookPeer.doSelect(criteria, mapper);
List<Object> mappedRow = queryResult.get(0);
book = (Book) mappedRow.get(0);
author = (Author) mappedRow.get(1);
if (book.getAuthorId() == author.getAuthorId())
{
fail("wrong Ids read");
}
}