--
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 jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Our use case is we have a DefaultRecordListener that overrides the storeStart and insertStart methods to populate some created_at and modified_at fields that all our tables have.
However, in one area we are performing a bulk insert using the DSLContext.insertInto(Table, Fields) syntax.$
I tried registering a DefaultExecuteListener but all that gives me access to is an ExecuteContext which doesn't seem to provide any methods to modify the statement. To me that would seem the most logical place to provide some hooks to modify the query before being executed.
Yeah I think we are wanting to avoid database triggers for right now.
I'll take a look at the VisitListener approach. That sounds promising.
visitContext.context().sql(", ")
.visit(MY_TABLE.MODIFIED_AT)
.sql(" = ")
.visit(DSL.val(new Timestamp(System.currentTimeMillis())));
--
We shouldn't trigger
RecordListener
. The listener is only triggered on actualUpdatableRecord.store()
methods, and similar. In this case, the record is "abused" as aMap
, whose contents is simply transferred to some other data structure. We don't know:
INSERT .. ON DUPLICATE KEY UPDATE
)It would be unwise to tie the
RecordListener
lifecycle to this API usage.