Ah, thanks Lukas.

So I think my preferred approach would be to use the Schema specified in 
the JDBC URL that I use to create the Connection objects.  The 
documentation isn't quite clear on how to do this.  The "Using a Default 
Schema" section says:

Another option to switch schema names is to use a default schema for the 
> Factory's underlying Connection. Many RDBMS support a USE or SET SCHEMA 
> command, which you can call like this:
> // Set the default schema
> Schema MY_BOOK_WORLD = ...
> create.use(MY_BOOK_WORLD);
> // Run queries with factory having a default schema
> create.selectFrom(T_AUTHOR).fetch();


I'm confused though - will this use the schema specified for the underlying 
connection (I assume the one specified in the JDBC URL), or will it use the 
MY_BOOK_WORLD schema?

Ian.

On Monday, April 23, 2012 5:06:52 PM UTC-5, Lukas Eder wrote:
>
> Hello Ian,
>
> > Is it possible to set the schema to use at runtime for the generated
> > sources?
>
> Yes, have a look at this section of the manual:
> http://www.jooq.org/manual/ADVANCED/SchemaMapping/
>
> You can override schema names both at codegen-time and at runtime, or
> make it disappear entirely by specifying a default schema at runtime.
>
> Cheers
> Lukas
>
> 2012/4/24 Ian Clarke <[email protected]>:
> > We have different staging and production database schema, and we use mvn
> > generate-sources to generate the Jooq bindings.  Unfortunately, I 
> discovered
> > that regardless of which database schema is specified in the JDBC URL 
> when I
> > create the SQL Connection, it is overridden by the schema specified in 
> our
> > pom.xml.
> >
> > Is it possible to set the schema to use at runtime for the generated
> > sources?
> >
> > Thanks,
> >
> > Ian.
> >
> > --
> > Ian Clarke
> > Blog: http://blog.locut.us/
> >
>
>

Reply via email to