When I try to do a batch update on a stale record it fails and does not 
throw any kind of exception. For example:

RoleRecord roleRecord = new RoleRecord();
roleRecord.setName("role"); // name is the PK for this table


roleRecord.attach(configuration);
roleRecord.insert();

assertThat(roleRecord.getVersion()).isEqualTo(1);
assertThat(roleRecord.getDescription()).isNull();

roleRecord.setDescription("desc1");
DSL.using(configuration).batchUpdate(roleRecord).execute(); // this works fine 
as we have the most current roleRecord 

RoleRecord fromDB = 
DSL.using(configuration).selectFrom(ROLE).where(ROLE.NAME.eq("role")).fetchOne();

assertThat(fromDB.getDescription()).isEqualTo("desc1");
assertThat(fromDB.getVersion()).isEqualTo(2);

roleRecord.setDescription("desc2");
DSL.using(configuration).batchUpdate(roleRecord).execute(); // does not throw 
DataChangedException, we have a stale roleRecord here
//roleRecord.update(); // throws a DataChangedException which is the correct 
behaviour

fromDB = 
DSL.using(configuration).selectFrom(ROLE).where(ROLE.NAME.eq("role")).fetchOne();

assertThat(fromDB.getVersion()).isEqualTo(3); // fails
assertThat(fromDB.getDescription()).isEqualTo("desc2"); // fails

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to