Hello,

Thank you very much for your suggestion and for digging up that blog post.
I'm glad I wrote it :)

I'm really reluctant to add this functionality out of the box for the
reasons mentioned in the post, even as a configurable opt-in option.
UpdatableRecord is already governed by many options, each of which
contributing to more complexity.

What looks really simple in the context of a store() call needs to be
viewed in a more global context, e.g. when passing a Record to an Update
statement through set(Record), and in many other parts of the API. In fact,
you're not really looking for a change of store() behaviour, but for a
change of changed() behaviour.

However, I think it should be easy for you to work around this issue by
implementing a RecordListener, that would reset "unmodified" fields prior
to calling store().

I hope this helps,
Lukas

2017-10-19 0:22 GMT+02:00 <[email protected]>:

> Hi,
> I am updating a bunch of records in the DB like this:
>
>   // fetch a bunch of records
>   records = ...
>
>   for (Record r : records) {
>     // update logic
>
>     r.store();
>   }
>
>
> I hoped the UPDATE statement would be issued only if the record is
> modified. However, it is issued every time a record is touched.
>
> I read: https://blog.jooq.org/2017/06/28/orms-should-update-
> changed-values-not-just-modified-ones/ and that was pretty helpful to
> explain the difference.
>
> Is it possible to get modified semantics with JOOQ? I could fix my code to
> replace every setXYZ with if ... setXYZ but it will generate too much
> boilerplate
>
> Would doing something like:
>
>   if (!r.original.equals(r)) {
>     r.store();
>   }
>
> at the end work in general case?
>
> Thanks!
>
> --
> 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.
>

-- 
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