openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Teresa Kan (JIRA)" <j...@apache.org>
Subject [jira] Updated: (OPENJPA-399) openjpa did not handle multiple schema names with same table name
Date Wed, 17 Oct 2007 20:58:50 GMT

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

Teresa Kan updated OPENJPA-399:
-------------------------------

    Attachment: OPENJPA-399_2.patch

There was another problem occurred in SQLServer that the dict.getColumns() can't find the
table names because openjpa alway convert the table name to upper case. The table name is
case sensive on SQLServer, therefore, no tables are found. Openjpa created the tables again
and failed with duplicate tables.

The fix will introduce a getSchemaCase() method on DBDictionary. SQLServerDictionary overrides
this method to return the SCHEMA_CASE_PERSERVE.

Original code in  DBDictionary on the convertSchemaCase :
 protected String convertSchemaCase(String objectName) {
        if (objectName == null)
            return null;

        if (SCHEMA_CASE_LOWER.equals(schemaCase))
            return objectName.toLowerCase();
        if (SCHEMA_CASE_PRESERVE.equals(schemaCase))
            return objectName;
        return objectName.toUpperCase();
    }

Fix will be :

 protected String convertSchemaCase(String objectName) {
        if (objectName == null)
            return null;

        String scase = getSchemaCase();
        if (SCHEMA_CASE_LOWER.equals(scase))
            return objectName.toLowerCase();
        if (SCHEMA_CASE_PRESERVE.equals(scase))
            return objectName;
        return objectName.toUpperCase();
    }

> openjpa did not handle multiple schema names with same table name
> -----------------------------------------------------------------
>
>                 Key: OPENJPA-399
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-399
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.0.1
>         Environment: JDK1.5, OPENJPA verison 580425
>            Reporter: Teresa Kan
>            Assignee: Teresa Kan
>         Attachments: OPENJPA-399_2.patch, OPENJPA_399.patch
>
>
> Two entities have the same table name but with different schema, only one table is created.
In addition, when two entities use the generatedType.AUTO for ID, only one OPENJPA_SEQUENCE-TABLE
is created.
> The problem due to the SchemaGroup.findTable() which only looked for a table name from
all the schemas. Once the table was found in one of the schema then it exited and assumed
that the table existed. Same problem in the TableJDBCSeq.addSchema().

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message