Hello.

I think the current SchemaMapping provides a viable solution for both 
"worlds".

Well, I think my problems usually originate from incomplete reading of 
documentation. The problem is that being short of time usually, I'm reading 
only the parts, that are vital and relevant. The title "Support for multiple 
equivalent schemata" sounded rather mysterious and irrelevant for MySQL and 
was skipped in reading ;)

Schemata mapping is a very interesting feature now that I start thinking of 
it. But speaking of dreams.... ;)

Well, I at nights I dream about jooq having two operation modes: "fully 
qualified schemata objects naming" and "short schemata objects naming".

In full mode jooq always prefixes the names of all objects in schema with 
schema name. This mode is where schema mapping plays best. 

In short mode jooq omits schema names from queries relying on the database 
server notion of "default schema". Most database servers has USE SQL 
statement which sets it as I know. I think JDBC connection link usually have 
default schema for connection also. In this mode no schema mapping is needed 
at all and this is the way most dear to MySQL users, I think because we are 
used to physical separation of databases and default database per connection 
settings.

Short mode is also useful for debugging because SQL queries (having all 
schema names omitted) become more readable. And the ability to switch to 
full mode in production is simply miraculous.

While we're discussing this, do you think you might need a TableMapping as 
well, in case some of your tables cannot be named the same way in production 
as in your development environments?


I never happened to need table mapping in past. But as for use cases... 

For example, we have some logging in database in the table "log". And we 
want this logging to be transparent. And we want customizable log rotation. 
In this case we can setup table mapping so that the most recent table is 
always referred to as "log" being actually named "log_2011-05-25" or 
"log_2011-05" depending on rotation settings and others are invisible from 
jooq.

This is as I understand, table-by-table mapping. Can you provide an example 
of prefix mapping? I didn't catch it.

Reply via email to