Hello Eric, community

Following up on recent requests by Eric (and some time ago by Sergey),
I have implemented a custom Exception handler in the ExecuteListener
interface. I do not believe that this should be part of the Factory,
or the Factory proxy, as exception handling is not necessarily
specific to the way we connect to the database. Also, if the Exception
mapping is taken out of the current FactoryProxy / Executor
discussion, things will greatly simplify.

Your custom ExecuteListener can receive exception notification events
through ExecuteListener.exception(ExecuteContext ctx). The
ExecuteContext then contains the DataAccessException about to be
thrown, as well as the underlying SQLException. You can change that
exception to something else and let jOOQ throw your own custom
RuntimeException.

For more details about the ExecuteListener, see the manual:
http://www.jooq.org/manual/ADVANCED/ExecuteListener/

and Javadoc sections:
http://www.jooq.org/javadoc/latest/org/jooq/ExecuteListener.html

The Trac ticket:
https://sourceforge.net/apps/trac/jooq/ticket/910

This is now committed on GitHub and will be included in jOOQ 2.3.0

Cheers
Lukas

Reply via email to