Hi,

I've configured optimistic locking:

@Configuration
public class SakilaJooqConfiguration {

@Bean
public DefaultConfigurationCustomizer configurationCustomizer() {
    return (DefaultConfiguration c) -> c.settings()
        .withExecuteWithOptimisticLocking(true);
    }
}

Now I try to use a DAO with a POJO to read and update:

var rentalDao = new RentalDao(dsl.configuration());

rentalDao.findOptionalById(854L).ifPresent(rental -> {
    rental.setRentalDate(LocalDateTime.now());
    rentalDao.update(rental);
});

But this leads to 


org.jooq.exception.DataChangedException: Database record has been changed

at 
org.jooq.impl.UpdatableRecordImpl.checkIfChanged(UpdatableRecordImpl.java:507)
at 
org.jooq.impl.UpdatableRecordImpl.storeMergeOrUpdate0(UpdatableRecordImpl.java:345)
at 
org.jooq.impl.UpdatableRecordImpl.storeUpdate0(UpdatableRecordImpl.java:240)
at 
org.jooq.impl.UpdatableRecordImpl.lambda$storeUpdate$1(UpdatableRecordImpl.java:232)
at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:144)
at 
org.jooq.impl.UpdatableRecordImpl.storeUpdate(UpdatableRecordImpl.java:231)
at org.jooq.impl.UpdatableRecordImpl.update(UpdatableRecordImpl.java:168)
at org.jooq.impl.UpdatableRecordImpl.update(UpdatableRecordImpl.java:163)
at org.jooq.impl.DAOImpl.update(DAOImpl.java:210)
at org.jooq.impl.DAOImpl.update(DAOImpl.java:186)

When I debug into UpdatableRecordImpl I see that in the record only the id 
is set.

Is this a bug or did I miss somehting?

Thanks, 
Simon

-- 
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 jooq-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/b734e1bf-0121-47a2-be39-196b0cd8b1e5n%40googlegroups.com.

Reply via email to