[#2836] Bad values are stored in record when projecting "ambiguous" column names into a generated record - Added failing integration test

This commit is contained in:
Lukas Eder 2013-12-07 12:57:33 +01:00
parent 8c41433d4c
commit d149585f29
2 changed files with 25 additions and 3 deletions

View File

@ -1220,6 +1220,23 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
}
}
@Test
public void testFetchIntoTableRecordsWithColumnAmbiguities() throws Exception {
// [#2836] When fetching into TableRecord types, the "expected" behaviour would
// be to map "obvious" columns onto their corresponding values
// Fixing this might be a "dangerous" change.
B book =
create().select()
.from(TBook())
.join(TAuthor())
.on(TBook_AUTHOR_ID().eq(TAuthor_ID()))
.where(TBook_ID().eq(4))
.fetchOneInto(TBook().getRecordType());
assertEquals(4, (int) book.getValue(TBook_ID()));
}
@Test
public void testFetchAttachables() throws Exception {
// [#2869] DefaultRecordMapper should recognise Attachable types and attach them
@ -1227,14 +1244,14 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
B b1 = create().selectFrom(TBook()).where(TBook_ID().eq(1)).fetchOne();
B b2 = b1.into(TBook().getRecordType());
assertNotNull(((AttachableInternal) b1).configuration());
assertNotNull(((AttachableInternal) b2).configuration());
B b3 = create(new Settings().withAttachRecords(false))
.selectFrom(TBook()).where(TBook_ID().eq(1)).fetchOne();
B b4 = b3.into(TBook().getRecordType());
assertNull(((AttachableInternal) b3).configuration());
assertNull(((AttachableInternal) b4).configuration());
}

View File

@ -1496,6 +1496,11 @@ public abstract class jOOQAbstractTest<
new FetchTests(this).testFetchIntoTableRecords();
}
@Test
public void testFetchIntoTableRecordsWithColumnAmbiguities() throws Exception {
new FetchTests(this).testFetchIntoTableRecordsWithColumnAmbiguities();
}
@Test
public void testFetchAttachables() throws Exception {
new FetchTests(this).testFetchAttachables();