Hi Venkat, Your observation is correct, this is how jOOQ works. jOOQ will internally set changed flags even if the value you're setting is equal to the value already present in the record. The reason for this is:
- This allows you to enforce inserting / updating NULL and other values, to override a potential DEFAULT value present in the database. See also this interesting thread on that subject: http://stackoverflow.com/q/18276421/521799 - This allows you to enforce any DML at all, even if no value has changed. I think that this behaviour would deserve some mentioning in the Javadocs and possibly in the manual. I have registered #2701 for this documentation improvement: https://github.com/jOOQ/jOOQ/issues/2701 To prevent values from being stored, I guess you will have to either - Explicitly run a check prior to setting the value (tedious) - Use the new listener SPI for UpdatableRecords ( https://github.com/jOOQ/jOOQ/issues/2010), which is available from jOOQ 3.2 SNAPSHOT versions. With this SPI, you can compare record.getValue(C01) with http://www.jooq.org/javadoc/latest/org/jooq/Record.html#original(org.jooq.Field) to see if the value has really changed, independently of the changed flag at store time. Hope this helps Lukas 2013/8/16 Venkat Sadasivam <[email protected]> > The below sample code to set the same value as the original value but it > still shows as changed? Is there a way to compare the value for dirty check? > > FolderPropertyRecord propertyRecord = records.get(0); > propertyRecord.setC01(propertyRecord.getC01()); > LOGGER.info("Dirty Record: {}", propertyRecord.changed()); > > -- > 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/groups/opt_out. > -- 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/groups/opt_out.
