Hello,
> Hi, I notice internally that JOOQ stores whether there have been changes to
> a record. Is there a way to access this. I want to use it to detect if a
> record is dirty and needs committing. I can't find any public methods that
> expose the functionality. eg record.hasChanges(), or record.isDirty()
So far, I tried to avoid exposing these internals. But there's no
general reason why this shouldn't be exposed (I think). I'll evaluate
this as feature request #1848:
https://github.com/jOOQ/jOOQ/issues/1848
In the mean time, note that you can just store() any record. If there
are no changes, no SQL statement will be executed, and the result
should be 0:
record.setValue(VALUE, "changed value");
assertEquals(1, record.store());
assertEquals(0, record.store());
> Additionally it would be great to have the original values accessible also,
> but I can just fetch again from the database, so that's not a biggy :).
> Would also mean a lot more memory overhead I guess if you are updating a
> large recordset.
Original values are referenced in UpdatableRecords already, as can be seen here:
https://github.com/jOOQ/jOOQ/blob/master/jOOQ/src/main/java/org/jooq/impl/Value.java
This was necessary to implement the optimistic locking feature. I'll
consider exposing them as well.
Cheers
Lukas