>> If that is the case I would like to see less assumptions being
>> made by the JOOQ runtime about how an app wants to interact with the
>> DB with a transaction. But in fairness, my comment is a bit off topic
>> - this thread is about the code generator, not the runtime.
>
>
> Yes, the thread will become a bit confusing, but I'm curious about your
> feedback anyway. Perhaps start a new thread? I think we still have some
> spare threads left on Google Groups ;-)
On reflection, I think that part of my observation was down to the way
that that I've abstracted my use of JOOQ, which isn't necessary the
best way to do things.
So I've got a utility function that wraps a fluent DSL callback,
injects a pooled connection into it and handles all of the
commit/rollback/blow up scenarios generically:
public <T> T execute(Function<DSLContext,T> fun) {
T result = null;
// ... get a connection from the pool
// ... build a JOOQ context
try {
result = fun.apply(ctx);
}
// lots of failure handling here
finally {
// ... release connection
}
return result;
}
So I think maybe the issue I'm having in a few cases is that I'd like
access to the JDBC connection or the current statement, but I can't
necessarily get it from the DSLContext.
But I were to change the callback definition to inject both the
DSLContext and the underlying JDBC Connection into the callback, I
would have access to the Connection directly. I could also get access
to a JDBC statement if I only used the DSLContext to construct the
SQL. In this case I could build the SQL and create the relevant JDBC
statement from the Connection reference.
So this covers the regular usage of the fluent API callbacks.
I think where it gets a little bit more complicated is when you are
using custom bindings. In this case, you are more reliant on the API
of the binding context callbacks, since you're at quite a deep level
of the JOOQ API at this point.
But again, I think this might again be going off-topic - the relevant
use case is the thread titled "Oracle TIMESTAMP in UTC".
--
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.