Jooq 3.8.x generator: generate all databases in a schema

182 views
Skip to first unread message

Denis Miorandi

unread,
Sep 19, 2016, 11:34:52 AM9/19/16
to jOOQ User Group
Switching from jooq 3.7.4 to 3.8.4, when I generate a single db on a schema using and ulr like this

jdbc:jtds:sqlserver://xxxxxx:1433;databaseName=yyyyyyyyyy;

Results is a generation of all databases on dbo.* schema. I want to generate just one of it, like on 3.7.4.

How can I achieve this via maven plugin?
I've seen a schema selector but not a database selector. This prevent me to migrating







Lukas Eder

unread,
Sep 20, 2016, 9:01:28 AM9/20/16
to jooq...@googlegroups.com
Hi Denis,

Thank you for reporting this. In jOOQ 3.8, we've started supporting the org.jooq.Catalog type in the code generator, which is very useful in SQL Server, one of the few databases that allows multi-catalog queries (they're called databases in SQL Server).

Unfortunately, jOOQ 3.8 was shipped without #4794, which allows for configuring catalogs in the code generator, as many users don't want all the catalogs to be generated:

The best workaround so far is to use <includes/> and <excludes/> to exclude all the undesired catalogs. The catalogs themselves will still be generated, but they will at least be empty. If that's still an issue, you could remove those catalogs in a post-generation build step.

I hope this helps - and I'm sorry for the inconvenience.
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 jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Denis Miorandi

unread,
Oct 14, 2016, 10:22:04 AM10/14/16
to jOOQ User Group
Hi Lukas,
          ok, got it. It worked for me. Just a note. Is not clear from documentation how include / exclude work lookin at
http://www.jooq.org/doc/3.8/manual/code-generation/codegen-configuration/
I saw this method on source code to achieve this:

   protected final <T extends Definition> List<T> filterExcludeInclude(List<T> definitions, String[] e, String[] i, List<Filter> f) {

probably should be better explain in documentation that exclude have priority and i.e. exclude .* cut all irrispective of include definition.
 

<plugin>
<groupId>org.jooq.pro</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<configuration>
<generator>
<database>
<includes>(?i:MYCATALOG.dbo.*)</includes>
</database>
</generator>
</configuration>
<executions>
<execution>
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.

Lukas Eder

unread,
Oct 17, 2016, 6:56:24 PM10/17/16
to jooq...@googlegroups.com
Hi Denis,

Thank you very much for your feedback. The documentation that you've linked mentiones "excludes match before includes". Perhaps that's a bit too implicit to conclude that "match before" might mean "have priority"? I'll reword this to make it more clear. I've created an issue for this:
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.

Denis Miorandi

unread,
Oct 18, 2016, 6:55:56 AM10/18/16
to jooq...@googlegroups.com
Hi Lukas,
        you are right about documentation, it mention "excludes match before includes", but it's not so clear if and how you can mix include / exclude.

Tks for interesting.

--
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/nWE8RZKak5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Dott. Denis Miorandi
via dei Vignai 27
38060 - Nogaredo (TN)



rod...@gmail.com

unread,
Dec 5, 2016, 7:01:17 PM12/5/16
to jOOQ User Group
Hi,
I've encountered the same issue using jooq 3.8.6 and gradle-jooq-plugin 2.0.2.
While the <includes> trick works, jooq is still generating packages, CatalogImpl and SchemaImpl implementations for the rest of the catalogs.
Although <inputCatalog> is available for 3.8.6, gradle-jooq-plugin will not execute as it references jooq-codegen-3.8.0.xsd due to the value of Constants.XSD_CODEGEN (that is, if my analysis is correct).
Is there a way around this? namely, I'd like to have jooq ignore all catalogs except one.
Thanks

--
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/nWE8RZKak5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Denis Miorandi

unread,
Dec 6, 2016, 8:49:23 AM12/6/16
to jooq...@googlegroups.com
Empty catalog are always generated, also with filters.
Probably you should wait for 3.9 that allow to specify which catalog generate afaik,



To unsubscribe from this group and all its topics, send an email to jooq-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Lukas Eder

unread,
Dec 6, 2016, 7:18:34 PM12/6/16
to jooq...@googlegroups.com
Yes, I can confirm. jOOQ 3.8 will always generate all (possibly empty) catalogs on SQL Server. This is fixed only in 3.9 (due in December 2016)

To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.

Roded Bahat

unread,
Dec 7, 2016, 6:27:53 AM12/7/16
to jOOQ User Group
Thanks.
Reply all
Reply to author
Forward
0 new messages