Hi Manuel,

Thanks for your message. I've noticed that the programmatic example is
missing from this page:
https://www.jooq.org/doc/latest/manual/code-generation/codegen-generatorstrategy

I will fix this, soon:
https://github.com/jOOQ/jOOQ/issues/7681

In general, since the programmatic API was generated from the XSD using
XJC, there's always a 1:1 relationship between the XML version and the
programmatic one. So, simply write:

org.jooq.meta.jaxb.Configuration configuration = new
org.jooq.meta.jaxb.Configuration()
    .withGenerator(new org.jooq.meta.jaxb.Generator()
        .withDatabase(new org.jooq.meta.jaxb.Database()
            .withName("org.jooq.meta.derby.DerbyDatabase")
            .withInputSchema(schemaName))
        .withStrategy(new org.jooq.meta.jaxb.Strategy()
            .withName("org.jooq.codegen.KeepNamesGeneratorStrategy")
        .withTarget(new org.jooq.meta.jaxb.Target()
            .withPackageName(packageName)
            .withDirectory(pkgDirName)));
GenerationTool tool = new GenerationTool();
tool.setConnection(connection);
tool.run(configuration);


Notice, I've fixed all package names to what they're called in jOOQ 3.11
(org.jooq.meta, instead of org.jooq.util)

I hope this helps,
Lukas

Am Sa., 14. Juli 2018 um 05:07 Uhr schrieb Manuel Rossetti <
[email protected]>:

> I am trying to use the KeepNamesGeneratorStrategy via programmatic
> configuration.  Does anyone have an example of how to add this strategy to
> a programmatic configuration such as:
>
> Connection connection = dataSource.getConnection();
> org.jooq.util.jaxb.Configuration configuration = new 
> org.jooq.util.jaxb.Configuration()
>         .withGenerator(new Generator()
>                 .withDatabase(new org.jooq.util.jaxb.Database()
>                         .withName("org.jooq.util.derby.DerbyDatabase")
>                         .withInputSchema(schemaName))
>                 .withTarget(new Target()
>                         .withPackageName(packageName)
>                         .withDirectory(pkgDirName)));
> GenerationTool tool = new GenerationTool();
> tool.setConnection(connection);
> tool.run(configuration);
>
> --
> 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