Digest for jooq-user@googlegroups.com - 4 updates in 2 topics

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Digest for jooq-user@googlegroups.com - 4 updates in 2 topics

http://groups.google.com/group/jooq-user/topics mailing list
[hidden email]: Oct 18 03:22PM -0700

I am updating a bunch of records in the DB like this:
// fetch a bunch of records
records = ...
for (Record r : records) {
// update logic
I hoped the UPDATE statement would be issued only if the record is
modified. However, it is issued every time a record is touched.
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
Would doing something like:
if (!r.original.equals(r)) {
at the end work in general case?
Lukas Eder <[hidden email]>: Oct 19 11:49AM +0200

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,
[hidden email]: Oct 18 03:45PM -0700

Super small request
Can you please add *isFetched()* convenience method to a Record? Currently
this field is private and cannot be read
Thanks for the great work!
On Wednesday, July 6, 2016 at 5:16:44 AM UTC-7, Lukas Eder wrote:
Lukas Eder <[hidden email]>: Oct 19 09:29AM +0200

Thanks a lot for your feedback. We could certainly add such a method, but
would you mind explaining your use-case first?
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].