On 12/9/2014 7:52 AM, Witold Szczerba wrote:
...
So now that this SQL statement is finished and executed, jOOQ will "close"
the connection, which normally would return it to the pool. Does TxManager
step in and keep the connection from going back into the pool?
Yes, it does. Connection does not go back to pool yet.
9. So now let's start storing the car:
CarRecord carRecord = dslTransaction.newRecord(CAR);
...
carRecord.store();
Again, where does jOOQ get its connection? Does the managed data source
ensure that it gets the same connection as before? After the transaction is
over, does the manage data source simply pass the connection requests (that
are not part of any transaction) on to the underlying data source? If this
is how it all works, then I suppose it's starting to make sense.
As I said in previous posts, jOOQ will get the same connection each
time within TxManager transaction. It won't close, commit, rollback or
give it back to the pool until TxManager say so.
OK, Witold, that makes sense and I like it. But just to clear up in my
mind how this all works, I wonder about the default jOOQ behavior if I
simply have a jOOQ Configuration wrapping a data source (with no Spring
and no pooling and no anything else).
Lukas, if I do /not/ use ULTM, and if I manually turn off autocommit on
a connection and then issue several jOOQ SQL commands, will jOOQ (via
the DataSourceConnectionProvider) request a different connection for
each command? (I read that jOOQ will close the connection after
execution of each command.) If so, then it would seem that all of the
jOOQ commands are using separate connections, because in this scenario I
have no connection pool and I don't have ULTM installed.
To simplify my question: with a DSLContext created from a jOOQ
configuration backed by a data source, if I manage transactions manually
on a connection, what is stopping jOOQ from creating new connections for
each command using the default DataSourceConnectionProvider?
(I am beginning to think that the answer is, "this won't work, because
jOOQ will indeed request a new connection for each command. I suspect it
only works in our application because the developer is passing around a
JDBC connection instance during a transaction, and forming a DSLContext
via DSL.using(connection) from the transaction connection rather than
DSL.using(jooqConfiguration).)
Garret
--
You received this message because you are subscribed to the Google Groups "jOOQ User
Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.