Hi Thierry,

Thanks for your suggestion. There had been similar thoughts like yours in
the past, although rejected for now:
https://github.com/jOOQ/jOOQ/issues/1933

The general idea is that the existing plain SQL functionality (
http://www.jooq.org/doc/latest/manual/sql-building/plain-sql) could be
applied to SQL code that is taken from external files or other resources
(e.g. classpath resources, input streams, readers, etc.). With more
sophisticated templating mechanisms than the existing QueryPart
placeholders (e.g. SELECT {0}, {1} FROM {2}), we could implement something
very similar to MyBatis, in fact.

Essentially, this might then apply to all API methods that are currently
annotated with @PlainSQL

Starting to support this in DSLContext#execute() and DSLContext#fetch()
methods would certainly make sense, as well as backing the implementation
via DSL#sql()

Cheers,
Lukas


2015-09-29 13:46 GMT+02:00 <[email protected]>:

> Hello,
>
> I thought it might be useful to have other methods in the DSLContext
> interface for executing plain SQL.
> Indeed it may be useful to have a DDL SQL script generating schemas and
> tables inside the source code of an application in order to:
>
>    - set up the database in the development process ;
>    - generate the meta model using the jOOQ codegen tool
>    - be able to quickly set up a database for unit tests and so, be
>    certain the database for tests has the same structure as the production
>    environment.
>
> As jOOQ already provides a DSLContext#execute(String) method, other
> methods could rely on it to have the same exception management as this
> method.
>
> What do you think of the idea? And what are the other template sources you
> have in mind?
>
> Regards,
> Thierry
>
> --
> 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.
>

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