
jOOQ Masterclass
By :

jOOQ comes with a significant number of listeners that are quite versatile and useful in hooking us into jOOQ life cycle management for solving a wide range of tasks. Let's "arbitrarily" pick up the mighty ExecuteListener
.
For instance, one of the listeners that you'll love is org.jooq.ExecuteListener
. This listener comes with a bunch of methods that can hook in the life cycle of a Query
, Routine
, or ResultSet
to alter the default rendering, preparing, binding, executing, and fetching stage. The most convenient approach to implement your own listener is to extend the jOOQ default implementation, DefaultExecuteListener
. This way, you can override only the methods that you want and you keep up with the SPI evolution (however, by the time you read this book, it is possible that this default listener will have been removed, and all methods are now default methods on the interface). Consider applying this technique to any other jOOQ...