Hello Nicholas, Thank you for your enquiry. You're right, this is currently not possible, as the insert() / update() / store() operations currently only fetch the generated identity value back into the record, not the other values generated by triggers or default expressions. There's a pending feature request for this: https://github.com/jOOQ/jOOQ/issues/1859
In general, you're probably better off writing a database trigger for your audit log. This will make sure that changes produced by bulk inserts / updates will also be reflected in your audit log. You probably cannot guarantee that all insertions will go through Record.insert() and thus through RecordListener.insertEnd(). I hope this helps, Lukas 2015-10-09 13:11 GMT+02:00 Nicholas Hu <[email protected]>: > Hi guys, > > I am implementing my own record listener to catch all insert/update/delete > operations and insert a corresponding record to a audit table with the same > values in addition to serveral self-defined fields like Hibernate. > > However, I found the default value defined in MySQL is lost or not updated > when insertEnd() is called in my own record listener. e.g. I defined a > table with a field 'STATUS' with definition: > > CHAR(1) not null default "A" > > When a record is inserted into the table with implicit value for the > field, the record got created with the default value. But in the callback > insertEnd(), the default value is not updated. In this case I can't have > the default value for the insertion of audit table. > > Am I wrong or can anyone help? Thanks. > > Best Regards, > Nicholas > > -- > 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. > -- 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.
