Hello Vasily, > Firstly, JOOQ is very useful, thanks for your work.
Thank you. > Secondly, a quick question. I have tried for a while to find ways to make > use of parameterised queries with JOOQ. [...] This is an open feature request: https://sourceforge.net/apps/trac/jooq/ticket/385 Currently, it's not possible to reuse the exact same PreparedStatement (and thus keeping relevant cursors open in the database). While I don't think that jOOQ will generate much overhead in Java by re-constructing the query, it might be interesting to avoid the soft-parse in the database, caused by preparing the statement again. I'm currently not sure how to expose this elegantly in the API: - How to expose the flag to keep the underlying PreparedStatement open? - How to bind new values? When constructing the query, the bind values are in the right context (e.g. a=?, b=?). When re-binding, you'd have to provide values by index. I'm open to ideas. One possibility is to create a "session" // ------------------------------------------------------------ Session session = create.session(); session.setKeepPreparedStatementsOpen(true); session.fetch(select); session.execute(insert); // Re-using PreparedStatements from before session.fetch(select); session.execute(insert); // Closing PreparedStatements session.close(); // ------------------------------------------------------------ The session could also be used later to abstract and enable access to transactions somehow Cheers Lukas
