Hi Ryan, >> Every record would hold one more reference (or null), which is OK. But >> I'm not such a big fan of adding one additional reference to every >> org.jooq.impl.Value object. Maybe there is a simpler implementation, >> that doesn't need one reference per value. > > Do all the "setValue" calls go through the record object? or can it happen > directly on the value object?
In jOOQ, internally, yes it can happen. AbstractRecord exposes its values for jOOQ's internals. >From the public API, no, it cannot happen. > Can these listeners go in UpdatableRecordImpl instead of the base Record > class? That might be worth exploring. I have thought about this before, as "base records" (e.g. records fetched from joined relations) might not really need all the overhead produced from "changed" flags, "original" values and now, these listeners. That's something to be decided in jOOQ 3.0. On the other hand, you can transform record types into other record types using the into() and from() methods. So maybe, some users would still like to see these flags, etc on the base records as well... >> Nothing that ExecuteListener could help you with, so far? I'm open to >> any more detailed elaboration of your ideas! > > Yes, my plan is to use the execute listener and parse the SQL statement to > get Tables / Fields updated. It would be great if the update initiated from > an UpdatableRecord to actually pass that record, or if it was an Update > statement then to pass the fields in the statement. It would save me parsing > the SQL :). I know you can write SQL in JOOQ, but if this additional > information available then I could use it in preference. [...] I see, thanks for sharing! I've noticed that people start to try to use jOOQ for such elaborate plans. It's a good way to implement central triggering / validation / audit trails. Currently, what you need is only possible through SQL parsing or through reflection. The actual query object is available from ExecuteContext.query(): http://www.jooq.org/javadoc/latest/org/jooq/ExecuteContext.html#query() However, jOOQ's Query subtypes currently don't expose their internals. This is a pending feature request on the roadmap for jOOQ 3.0: https://github.com/jOOQ/jOOQ/issues/1492 I've tried implementing this ticket before, but I'm afraid it won't be possible sensibly, without breaking (some) API. Hence it cannot be shipped before the next major release. > Anyway, once I have it working (hopefully!) I'll let you know if it works, > or if it is fundamentally floored and was never going to work. I'd be glad to hear that! Cheers Lukas
