[#1802] Result.into(Table) doesn't work correctly, if the same field

name appears twice in Result - Added integration test
This commit is contained in:
Lukas Eder 2012-09-06 23:05:53 +02:00
parent 1c9511e329
commit f5235455e7
2 changed files with 30 additions and 0 deletions

View File

@ -973,6 +973,31 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, I, IPK, T658,
assertEquals("Animal Farm", books2.getValue(4, TBook_TITLE()));
}
@Test
public void testFetchIntoTables() throws Exception {
Result<Record> result =
create().select()
.from(TBook())
.join(TAuthor()).on(TBook_AUTHOR_ID().eq(TAuthor_ID()))
.orderBy(TBook_ID())
.fetch();
Result<A> a = result.into(TAuthor());
Result<B> b = result.into(TBook());
assertEquals(4, a.size());
assertEquals(4, b.size());
assertEquals(BOOK_AUTHOR_IDS, a.getValues(TAuthor_ID()));
assertEquals(BOOK_FIRST_NAMES, a.getValues(TAuthor_FIRST_NAME()));
assertEquals(BOOK_LAST_NAMES, a.getValues(TAuthor_LAST_NAME()));
assertTrue(TAuthor().getRecordType().isAssignableFrom(a.get(0).getClass()));
assertEquals(BOOK_IDS, b.getValues(TBook_ID()));
assertEquals(BOOK_TITLES, b.getValues(TBook_TITLE()));
assertTrue(TBook().getRecordType().isAssignableFrom(a.get(0).getClass()));
}
@Test
public void testFetchIntoCustomTable() throws Exception {

View File

@ -1067,6 +1067,11 @@ public abstract class jOOQAbstractTest<
new FetchTests(this).testFetchIntoTable();
}
@Test
public void testFetchIntoTables() throws Exception {
new FetchTests(this).testFetchIntoTables();
}
@Test
public void testFetchIntoCustomTable() throws Exception {
new FetchTests(this).testFetchIntoCustomTable();