Hi Stephane,
> What are your plans for v3?
Many
> Are you going to let the Factory stuff as is and opt for a new set of
> session articulated classes? After all, the current code is perfectly
> suitable for people just willing to feed JDBC Connections to the jooq API.
jOOQ 3.0 will be backwards-compatible in large parts. Even if there
will be fundamental changes in handling sessions/connections/data
sources/transactions, this should not impact the overall API. The
current state of favourable ideas includes these:
1. Better integrate Settings and Configuration. The two have similar
semantics. Their separation is confusing
2. Split Factory into its current query construction and and query
execution parts. Query construction should be completely stateless and
static (an open point is the current convenience of actually executing
an "attached" Query, rather than passing it to an executor. But I'll
find a solution to that)
3. Separate Configuration and Factory. Factory should be stateless
(this could be redundant with 2)
4. Implement session/connection/transaction lifecycle strategies that
can be fully customised. With step 2. implemented, this will be easier
to achieve
Other, minor improvements can be seen here:
https://github.com/jOOQ/jOOQ/issues?milestone=17&state=open
> As an API break you may think about "murdering" the Datasource support the
> way it is, after all the connection-per-statement pattern is pretty limited [...]
Yes. As many other things, this was designed to suit one set of users.
Those with J2EE distributed transactions, and spring-managed data
sources, that behave the same way.
> and somewhat inconsistent with FactoryOperation interface which has JDBC
> transaction support,
Yes. That was added to suit another set of users who want to operate
on their standalone connections, handling transactions directly on
those connections. They don't want to deal with SQLExceptions
> moreover it seems to complicate the code by requiring
> many wrappers, creating at least as many problems than it solves).
For incremental API building, I guess the current solution is as good
as it could get. Short-term improvement suggestions are welcome, but I
think I'd better focus on 3.0, in that field.
> Then
> maybe you could introduce datasource support by other means, for example
> something as simple as a class taking a DataSource in its constructor and
> responsible for providing Connection-based Factory objects on demand. It
> would just require the factory to take ownership of the Connection and have
> some close() / closeQuietly() methods.
That would be resolved with those "query executors" mentioned in step
2. When query building and query execution are cleanly separated, it
will be easy to manage several strategies for the connection
lifecycle.
One idea that I will keep in mind is that by Aaron Digulla, who
recently claimed that a ConnectionProvider would solve many problems.
In essence, those "query executors" would in fact be such connection
providers to jOOQ's internals.