By the way, let us know if you still have some doubts. I know these things
can seem a bit odd when you see them the first time - and we always strive
to improve the manual and tutorial for new users!

2014-10-27 20:59 GMT+01:00 Lukas Eder <[email protected]>:

> Hello,
>
> I'm going to ask the same question as Witold: Why do you want to use jOOQ
> only as a SQL builder in your case, and run the PreparedStatement yourself?
> jOOQ has managed PreparedStatements internally for 5 years now. I'm pretty
> sure we got this right and you don't have to worry about any JDBC resources
> anymore:
>
> - Use a single ConnectionProvider to provide jOOQ with a Connection
> - jOOQ will create and close the PreparedStatement automatically
> - jOOQ will create and close any ResultSets automatically
>
> Your own code will simply not see any JDBC resources. So, the "best
> practices" would then be to use jOOQ for executing the query. This also
> applies for CRUD. The Connection is already supplied to jOOQ internally via
> a ConnectionProvider, which is attached to all UpdatableRecords, when you
> fetch them. You can just call UpdatableRecord.store() to store them.
>
> The main reasons why jOOQ allows for extracting the SQL string are:
>
> - Logging
> - Caching of the SQL
> - Actual SQL execution "elsewhere" (e.g. on another server)
>
> I understand that by "squiggly hell java 6 conventions", you probably mean
> the opening and closing of JDBC connections in the tutorial? (
> http://www.jooq.org/doc/latest/manual/getting-started/tutorials/jooq-in-7-steps/jooq-in-7-steps-step6/),
> yes that should be fixed - we should do those examples with
> try-with-resources. I've registered an issue for this:
> https://github.com/jOOQ/jOOQ/issues/3717
>
> Also, there is currently no direct way to access the Query's internal
> PreparedStatement through public API. We might be fixing that soon, via:
> https://github.com/jOOQ/jOOQ/issues/3715. The only way you can access the
> PreparedStatement right now is by implementing an ExecuteListener, although
> I doubt that this is what you want to do:
> http://www.jooq.org/doc/latest/manual/sql-execution/execute-listeners/
>
> Cheers,
> Lukas
>

-- 
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.

Reply via email to