Thanks, I will, soon

On Wed, May 17, 2023 at 5:06 PM Simon Martinelli <simon.martine...@gmail.com>
wrote:

> I didn't configure any column so it should use all columns.
>
> You can try it yourself: https://github.com/simasch/jooq-workshop
> (Make sure Docker is running locally)
>
> That's the test that causes the problem:
>
> https://github.com/simasch/jooq-workshop/blob/main/jooq-sakila/src/test/java/ch/martinelli/edu/jooq/sakila/exercise/Ex06DaosTest.java
>
> On Wednesday, May 17, 2023 at 4:53:50 PM UTC+2 lukas...@gmail.com wrote:
>
>> Hi Simon,
>>
>> What column(s) did you configure for your optimistic locking checks? What
>> SQL queries are being generated in your debug logs?
>>
>> Best Regards,
>> Lukas
>>
>> On Wed, May 17, 2023 at 4:39 PM Simon Martinelli <simon.ma...@gmail.com>
>> wrote:
>>
>>> 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+...@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
>>> <https://groups.google.com/d/msgid/jooq-user/b734e1bf-0121-47a2-be39-196b0cd8b1e5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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/e5aca150-0b82-4618-8de9-d8d50092742fn%40googlegroups.com
> <https://groups.google.com/d/msgid/jooq-user/e5aca150-0b82-4618-8de9-d8d50092742fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAB4ELO4%3DB24xNNG1fLGFSu77Lqwsm%2BDuFNvD03A7OCZTo_iuhQ%40mail.gmail.com.

Reply via email to