[#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:
parent
8c41433d4c
commit
d149585f29
@ -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());
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user