Thank you for a super quick response, I didn't expect it :) The way I'm using generator is exactly this one (I'm using it as a task): http://www.jooq.org/doc/3.7/manual/code-generation/codegen-gradle/ To share database properties I'll use different environment settings only as strings for now.
But about this: DSLContext create = DSL.using(dataSource, SQLDialect.MYSQL); I'm currently beginner in Grails and Gradle, it's pretty different than JavaEE, so I'm getting into it. So maybe this would be a silly question, but I suppose that if I need to use *DSLContext* in some service class, I need to create it like the way you suggested. But if I know that it will always use the same datasource and dialect would be MySQL, could I somehow configure it on the lower level level of abstraction and just have DSLContext injected into service? Should I create some kind of filter for it or is there any plugin that provides it? Thanks again Tomáš Dne pondělí 4. ledna 2016 9:50:48 UTC+1 Lukas Eder napsal(a): > > Hi Tomáš, > > Thank you for your enquiry. The jOOQ runtime library allows for using > standard javax.sql.DataSource instead of Connection. Just pass it to the > using method: > > DSLContext create = DSL.using(dataSource, SQLDialect.MYSQL); > > > Surprisingly, this isn't possible right now using the jOOQ GenerationTool > API. I have created a feature request to implement this for jOOQ 3.8: > https://github.com/jOOQ/jOOQ/issues/4891 > > Just to be sure to get this right, how are you currently configuring the > code generator with Grails? Are you using the GenerationTool class for > programmatic configuration? > > Cheers, > Lukas > > 2016-01-04 9:34 GMT+01:00 Tomáš Cigler <[email protected] <javascript:>>: > >> Hi, >> >> I have defined datasources in differerent build environments in Grails >> configuration. Now I can use injected datasource in service for >> gathering connection and then instantiate >> DSLContext create = DSL.using(connection, SQLDialect.MYSQL) >> >> Is there a way that I can defaultly assign the datasource (maybe by some >> existing plugin or configuration) to DSL, from which it would take the >> connections itself and tell it that I want to always use MySQL dialect, so >> I can then omit >> using(connection, SQLDialect.MYSQL) >> >> Can I somehow use this datasource even for generator plugin, which >> generates POJOs, DAOs etc.? >> >> Thanks >> Tomáš >> >> -- >> 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] <javascript:>. >> 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.
