I would like to synchronize table from server A to B, the record should be exactly same from the source. It is just like manual replication work.
The method is retrieving from source record as json and insert/update to destination server to get same table records including version field.
I have a problem with updating from source to destination, I found no matter how the each fields are identical, it will update date modified and version field.
Any solution to force update those fields(version or date) without turn off optimistic locking parameter and bypass customized "DefaultRecordListener" class
As of jOOQ 3.11, it is not possible to bypass setting of record version or timestamp with an out of the box feature. I have created a feature request to implement this in jOOQ 3.12: https://github.com/jOOQ/jOOQ/issues/8924
There are a few workarounds, all of which assume that you've already turned off Settings.executeWithOptimisticLocking
in your data copying logic
RecordListener
If you're using record versions (not timestamps), you could set the record version to version - 1
prior to storing your record. That would lead to the version being updated again to the same value. A hack, but might be good enough.
You could re-generate all the tables involved in this operation a second time without record versions / timestamps, and use those alternative generated tables for your data copying.
UpdatableRecord
Instead of using UpdatableRecord
, you could write actual INSERT
statements. Notice that you can pass any Record
to an INSERT
statement via the InsertSetStep.set(Record)
method. It will have a similar effect as calling record.insert()
, i.e. only the changed fields will be inserted.