If you have a special case whose violation of normalisation principles
we won't discuss now ;-), you should use the regular jOOQ API for
updating records. For instance:
http://www.jooq.org/javadoc/latest/org/jooq/impl/Factory.html#executeUpdate(R)

> If the value
> was not null and it was changed, it should update.

The semantics put into store() on that occasion is documented in the
Javadoc. Due to the normalisation principles, changing the primary key
value can only mean wanting to create a copy of this record. On the
other hand, Record.copy() does precisely that, but more explicitly.

> Anyway, I don't see an issue with optionally changing the behaviour of
> store()? :)

I'm reluctant to modify that store() too much. It has too many
"clever" features already. On the other hand, its behaviour has been
challenged on this user group time and again. Maybe there is room for
discussion about a potential change in jOOQ 3.0

According to you, when store()ing a record, which was previously
loaded from the database, whose primary key value was modified in
Java, then the record should be updated as such:
UPDATE [table] SET [pk] = [new value], ... WHERE [pk] = [original value]

Note, the "original value" of any Record value is only available since
jOOQ 2.6.0:
https://github.com/jOOQ/jOOQ/issues/1849

Any other opinions on this subject?

Reply via email to