That's a very interesting problem. For historic reasons (jOOQ didn't always
support catalogs), jOOQ treats MySQL's databases (which are really
catalogs) as schemas - in practice they actually work in that way in
everyday SQL usage. But of course, this is conceptually wrong and should be
fixed in a future version, where jOOQ would generate catalogs for MySQL
rather than schemas (guarded with a flag for backwards compatibility). I've
created a feature request for this:
https://github.com/jOOQ/jOOQ/issues/5963

Your approach certainly works. Do note that you can also turn off schema
generation at code generation time. That will slightly speed up things at
runtime, as these checks won't need to be performed every time a table /
column is generated. On this page, look for "outputCatalogToDefault" and
"outputSchemaToDefault"
https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-catalog-and-schema-mapping/

With the generator strategy, you can only re-define how jOOQ's code
generator outputs Java elements, such as class names, member names, method
names, etc. You cannot re-define actual object names. That's what the
catalog / schema mapping feature is for, but it is, unfortunately, not
sophisticated enough for what you intend to do.

Let me know if turning off catalog/schema rendering or generating is
sufficient for you, or if you need more help
Best Regards,
Lukas

2017-03-10 16:14 GMT+01:00 Marcus Gattinger <[email protected]>:

> The solution I come up with is to omit the schema and catalog notion during 
> SQL generation:
> DSL.using(<data source>, <dialect>, new 
> Settings().withRenderSchema(false).withRenderCatalog(false)
>
> --
> 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