[ 
https://issues.apache.org/jira/browse/CAY-1772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrus Adamchik updated CAY-1772:
---------------------------------

    Description: 
While DbEntity has a 'catalog' property, we sort of ignore its presence, don't 
include catalogs in generated SQL, and advise users to enter it in the "schema" 
field. However there is a practical aspect of catalogs vs. schemas that became 
obvious when I started using 'cdbimport' with MySQL (see CAY-1759). MySQL only 
has a single notion of "database" as a table namespace unit within a given 
server instance. This maps to "catalog" in the MySQL JDBC driver (see [1], and 
[2] for explanation of schemas vs catalogs across DBs). 

While using schema in place of catalog was fine with manual mapping, it became 
a problem with reverse-engineered DataMaps that left the schema empty. So all 
the generated SQL based on such DataMaps would use bare table names, and if the 
catalog is not a part of JDBC URL, a namespace conflict would occur.

So we need to :

1. honor catalog setting in generated SQL
2. add "default catalog" DataMap, and "catalog" to DbEntity fields in the 
Modeler


[1] http://forums.mysql.com/read.php?39,137564,137629#msg-137629
[2] 
http://stackoverflow.com/questions/7942520/relationship-between-catalog-schema-user-and-database-instance

  was:
While DbEntity has a 'catalog' property, we sort of ignore its presence, don't 
include catalogs in generated SQL, and advise users to enter it in the "schema" 
field. However there is a practical aspect of catalogs vs. schemas that became 
obvious when I started using 'cdbimport' with MySQL (see CAY-1759). MySQL only 
has a single notion of "database" as a table namespace unit within a given 
server instance. This maps to "catalog" in the MySQL JDBC driver (see [1], and 
[2] for explanation of schemas vs catalogs across DBs). 

While using schema in place of catalog was fine with manual mapping, it became 
a problem with reverse-engineered DataMaps that left the schema empty. So all 
the generated SQL based on such DataMaps would use bare table names, and if the 
catalog is not a part of JDBC URL, a namespace conflict would occur.

So we need to :

1. honor catalog setting in generated SQL
2. add "default catalog" DataMap, and "catalog" to DbEntity fields in the 
Modeler
3. add catalog selection to reverse engineering dialog in the Modeler

[1] http://forums.mysql.com/read.php?39,137564,137629#msg-137629
[2] 
http://stackoverflow.com/questions/7942520/relationship-between-catalog-schema-user-and-database-instance

    
> Real support for DbEntity catalogs
> ----------------------------------
>
>                 Key: CAY-1772
>                 URL: https://issues.apache.org/jira/browse/CAY-1772
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library, Modeler
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.2M1
>
>
> While DbEntity has a 'catalog' property, we sort of ignore its presence, 
> don't include catalogs in generated SQL, and advise users to enter it in the 
> "schema" field. However there is a practical aspect of catalogs vs. schemas 
> that became obvious when I started using 'cdbimport' with MySQL (see 
> CAY-1759). MySQL only has a single notion of "database" as a table namespace 
> unit within a given server instance. This maps to "catalog" in the MySQL JDBC 
> driver (see [1], and [2] for explanation of schemas vs catalogs across DBs). 
> While using schema in place of catalog was fine with manual mapping, it 
> became a problem with reverse-engineered DataMaps that left the schema empty. 
> So all the generated SQL based on such DataMaps would use bare table names, 
> and if the catalog is not a part of JDBC URL, a namespace conflict would 
> occur.
> So we need to :
> 1. honor catalog setting in generated SQL
> 2. add "default catalog" DataMap, and "catalog" to DbEntity fields in the 
> Modeler
> [1] http://forums.mysql.com/read.php?39,137564,137629#msg-137629
> [2] 
> http://stackoverflow.com/questions/7942520/relationship-between-catalog-schema-user-and-database-instance

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to