[#1818] SQL Server "cannot insert explicit value for identity column

when IDENTITY_INSERT is set to OFF." - Added test case
This commit is contained in:
Lukas Eder 2012-09-14 09:47:05 +02:00
parent 83f5bf8388
commit bac4bb1178
2 changed files with 26 additions and 0 deletions

View File

@ -754,6 +754,27 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, I, IPK, T658,
assertNull(book.getValue(TBook_PUBLISHED_IN()));
}
@Test
public void testRecordFromWithIdentity() throws Exception {
if (TIdentityPK() == null) {
log.info("SKIPPING", "Reflection with IDENTITY tests");
return;
}
jOOQAbstractTest.reset = false;
// [#1818] SQL Server doesn't like inserting IDENTITY values...
IPK record = create().newRecord(TIdentityPK(), new Identity());
assertEquals(10, (int) record.getValue(TIdentityPK_ID()));
assertEquals(11, (int) record.getValue(TIdentityPK_VAL()));
assertEquals(1, record.store());
}
static class Identity {
public int id = 10;
public int val = 11;
}
@Test
public void testRecordFromUpdatePK() throws Exception {

View File

@ -1082,6 +1082,11 @@ public abstract class jOOQAbstractTest<
new FetchTests(this).testRecordFromWithoutAnnotations();
}
@Test
public void testRecordFromWithIdentity() throws Exception {
new FetchTests(this).testRecordFromWithIdentity();
}
@Test
public void testRecordFromUpdatePK() throws Exception {
new FetchTests(this).testRecordFromUpdatePK();