Hello Lukas,

Currently our boolean columns are prefixed with is_. So the pattern matching works fine. However, our date columns are named created, approved_on, start_date, plan_finish, last_reminded_at etc. I'm having to specify a pattern like (?i:.*\.(CREATED|DELETED|.*_DATE|.*_AT|.*_ON)). I think it will be better if we can simply specify a database type to be specified.


Thanks,
- Ravi

On Monday 09 April 2012 10:24 PM, Lukas Eder wrote:
Hello Ravi,

1. Can you explain what
<expressions>(?i:(.*?.)?T_BOOLEANS.(VC|C|N)_BOOLEAN)</expressions>  is trying
to do?
This is an example for a regular expression matching all objects that
will be forced to a given type. In this case, columns VC_BOOLEAN,
C_BOOLEAN, N_BOOLEAN from the table T_BOOLEANS in any schema will be
matched.

2. I'm a bit confused about schema names. Presently we connect to the
database with the db owner and use Apache Torque which generates SQL WITHOUT
prefixing the table names with schema names. So we don't have to know the
schema names like 'Public' in PG and 'dbo' (I guess) in SQL Server.
As I mentioned in the first mail, your best choice is to use the
RenderMapping to dynamically specify the default schema

new Factory(connection, dialect,
    new Settings().withRenderMapping(
    new RenderMapping().withDefaultSchema("public")));

jOOQ has been designed to work with multi-schema environments, that is
why the schema names are always rendered by default. If you think you
will only ever have one schema, and you want to prevent jOOQ's
rendering of schema names, set that schema as your default schema to
the render mapping. The rationale behind this functionality is
explained here:

http://www.jooq.org/manual/ADVANCED/SchemaMapping/

Another option is to map the Postgres "public" schema to "dbo" on SQL
Server, and to "your-oracle-schema" on Oracle, or alternatively, to
create the same schema name on every one of the three databases.

a) I've been able to run the GenerateTask with the following config.
[...]

Seems like here the InputSchema is empty. But I'm specifying the jdbcschema.
Can you explain the difference? The generated code works.
You'll find a warning in the generation logs indicating that
"jdbc.Schema" is a deprecated property. You should only use
inputSchema.

b) When I call

new Factory(connection, dialect,
    new Settings().withRenderMapping(
    new RenderMapping().withDefaultSchema("")));
I'm hoping that JOOQ will not prefix the table names with any schema name
and that the default schema for the user connected would be used. Again, the
purpose is to not concern ourselves with the schema name at all.
Then, please use the Setting's default schema, and set it to "public",
"dbo", "your-oracle-schema-name", depending on the database against
which you're running your query. I have added a feature request to add
a flag to the RenderMapping, that allows for avoiding schema names
entirely in rendered SQL:
https://sourceforge.net/apps/trac/jooq/ticket/1286

3) Regarding logging, log4j.properties is on the classpath and I've added
log4j.logger.org.jooq=DEBUG. Our log statements are coming through but not
JOOQ's. What am I missing?
I'm sorry, I don't have much experience configuring log4j. I've had no
issues with this configuration file:
https://github.com/lukaseder/jOOQ/blob/master/jOOQ-test/src/log4j.xml

Maybe you'll have better luck asking this question on Stack Overflow?

Cheers
Lukas

Reply via email to