On Fri, May 23, 2014 at 1:59 PM, Ben Hood <[email protected]> wrote:
> But this seems cumbersome. Is there some magic flag somewhere that can
> just ignore non-null fields when issuing updates?
Not sure whether this is idiomatic but the following update seems to work:
return db.execute(ctx -> {
UsersRecord user = ctx.newRecord(USERS);
user.from(u);
for (Field<?> f : user.fields()) {
if (user.getValue(f) == null)
user.changed(f, false);
}
return user.update() == 1;
}
);
Admittedly it does use the CRUDy part of JOOQ (it would be nicer if it
could just be an option on the plain jane fluent API), but it seems to
do the job.
--
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.