Search in sources :

Example 1 with Article

use of org.jdbi.v3.core.mapper.JoinRowMapperTest.Article in project jdbi by jdbi.

the class TestRegisterJoinRowMapper method testSqlObjectJoinRow.

@Test
public void testSqlObjectJoinRow() {
    Handle handle = dbRule.getSharedHandle();
    // tag::joinrowusage[]
    Multimap<User, Article> joined = HashMultimap.create();
    handle.attach(UserArticleDao.class).getAuthorship().forEach(jr -> joined.put(jr.get(User.class), jr.get(Article.class)));
    assertThat(joined).isEqualTo(JoinRowMapperTest.getExpected());
// end::joinrowusage[]
}
Also used : User(org.jdbi.v3.core.mapper.JoinRowMapperTest.User) Article(org.jdbi.v3.core.mapper.JoinRowMapperTest.Article) Handle(org.jdbi.v3.core.Handle) JoinRowMapperTest(org.jdbi.v3.core.mapper.JoinRowMapperTest) Test(org.junit.Test)

Aggregations

Handle (org.jdbi.v3.core.Handle)1 JoinRowMapperTest (org.jdbi.v3.core.mapper.JoinRowMapperTest)1 Article (org.jdbi.v3.core.mapper.JoinRowMapperTest.Article)1 User (org.jdbi.v3.core.mapper.JoinRowMapperTest.User)1 Test (org.junit.Test)1