Hi Lukas,

thank you for answering to my post. Actually I already have tried 
"outputCatalogToDefault" and "outputSchemaToDefault". But the result is not 
want I expected. 


For MySQL I use this configuration:

<database>
 <name>org.jooq.util.mysql.MySQLDatabase</name>
 <inputCatalog>my_database</inputCatalog>
 <inputSchema>my_database</inputSchema>
 <outputCatalogToDefault>true</outputCatalogToDefault>
 <outputSchemaToDefault>true</outputSchemaToDefault>
 <includes>.*</includes>
 <excludes>schema_version_.*</excludes>
</database>

I have played around with "inputCatalog", "outputCatalog", 
"outputCatalogToDefault" (omit them, use non-existing names, using 
true/false for the latter). The behaviour of the elements is quite weird to 
me:

   1. Omitting the element "inputCatalog" but using the "outputCatalog" 
   element always creates a catalog class named "_" using the value of the 
   "outputCatalog" element for the catalog name in the constructor.
   2. Omitting the elements "inputCatalog" and "outputCatalog" always 
   creates a catalog class named "DefaultCatalog" using an empty string for 
   the catalog name in the constructor. In doesn't matter if you use the value 
   "true" or "false" for "outputCatalogToDefault" element or omit this element 
   completely.
   3. Using the "inputCatalog" element behaves exactly like case no 2, i. 
   e. the elements "outputCatalog" and "outputCatalogToDefault" are ignored.

The element "inputSchema" is mandatory, however (and the value must match 
the database name). Otherwise no classes will be generated.

   1. Omitting the elements "outputSchema" and "outputSchemaToDefault" 
   creates a schema class named like the value of "inputSchema" element using 
   the value of the "inputSchema" element for the schema name in the 
   constructor.
   2. Using the element "outputSchema" but omitting the element 
   "outputSchemaToDefault" has the same effect than case no 1.
   3. Using the elements "outputSchema" and "outputSchemaToDefault" has 
   also the same effect than case no 1 (no matter whether the value "true" or 
   "false" is used).

The desired result will be generated only, if I use the elements 
"inputSchema" and "outputSchemaToDefault". Now the two classes 
"DefaultCatalog" and "DefaultSchema" are generated using an empty string 
for the catalog / schema name in the constructor.


To make the code generation work as expected for SQL Server both elements 
"inputCatalog" and "inputSchema" are mandatory. The value for 
"inputCatalog" must match the database name, the value for "inputSchema" 
must match the schema name (the genernal default is "dbo").

So in the end I was not able to find exaclty one combination of elements 
"inputCatalog", "inputSchema", "outputCatalogToDefault", 
"outputSchemaToDefault" that work for both DBMS types. Hence I was forced 
to use the solution of my previous post.

As site note I also configured the following "generator" elements:

<generate>
 <deprecated>false</deprecated>
 <fluentSetters>true</fluentSetters>
 <globalCatalogReferences>false</globalCatalogReferences>
 <globalRoutineReferences>true</globalRoutineReferences>
 <globalSchemaReferences>false</globalSchemaReferences>
 <globalTableReferences>true</globalTableReferences>
 <pojos>true</pojos>
 <records>true</records>
 <relations>true</relations>
</generate>

Cheers,
Marcus

-- 
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