I think there's a problem with the FactoryProxy (and also my code
above) if no transaction exists at all. In that case every method on
the FactoryProxy will result in obtaining a new connection from the
underlying DataSource which is never closed. That happens for example
if you use the FactoryProxy (or my code above) during startup of
Spring's aplication context, e.g. in a bean's "afterPropertiesSet"
method.
After a short time all available connections will be exhausted. Sure,
after a time the DataSource should close the abandoned connections,
but that really doesn't solve the problem. In our case the application
startup just hung forever after three calls (every call obtains a new
connection and creates a new factory behind the scenes) until timeout.

This lead me to the following conclusion:
- If the factories get refactored, they should take care about
obtaining and closing a connection. This allows for the factories to
operate in a non-transactional environment too and passing in a
"TransactionAwareDataSourceProxy" would perfectly integrate them with
Spring and it's transactional infrastructure.
- Therefore there should be no need that any interface or class of
jOOQ provides a "close" method - I even advise against this.

Are there any plans in which version the factories will accept a
DataSource?


Reply via email to