diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java index ea323bbe4..1e4b188be 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java @@ -819,8 +819,10 @@ public class SchemaGenerator { if (_log.isTraceEnabled()) _log.trace(_loc.get("gen-seqs", schemaName, sequenceName)); + // since all the sequences are generated under the default schema + // therefore, we can use the null schemaname to search Sequence[] seqs = _dict.getSequences(meta, conn.getCatalog(), - schemaName, sequenceName, conn); + null, sequenceName, conn); SchemaGroup group = getSchemaGroup(); Schema schema; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java index f8225eec6..1346a9688 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java @@ -94,7 +94,7 @@ public class DB2Dictionary "LONG VARCHAR FOR BIT DATA", "LONG VARCHAR", "LONG VARGRAPHIC", })); systemSchemas = new String( - "SYSCAT, SYSIBM, SYSSTAT, SYSIBMADM, SYSTOOLS"); + "SYSCAT,SYSIBM,SYSSTAT,SYSIBMADM,SYSTOOLS"); maxConstraintNameLength = 18; maxIndexNameLength = 18; maxColumnNameLength = 30; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java index ed681a545..6888521e8 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java @@ -3364,7 +3364,7 @@ public class DBDictionary try { int idx = 1; if (schemaName != null) - stmnt.setString(idx++, schemaName); + stmnt.setString(idx++, schemaName.toUpperCase()); if (sequenceName != null) stmnt.setString(idx++, sequenceName); @@ -3708,13 +3708,21 @@ public class DBDictionary if (objectName == null) return null; - if (SCHEMA_CASE_LOWER.equals(schemaCase)) + String scase = getSchemaCase(); + if (SCHEMA_CASE_LOWER.equals(scase)) return objectName.toLowerCase(); - if (SCHEMA_CASE_PRESERVE.equals(schemaCase)) + if (SCHEMA_CASE_PRESERVE.equals(scase)) return objectName; return objectName.toUpperCase(); } - + + /** + * Return DB specific schemaCase + */ + public String getSchemaCase(){ + return schemaCase; + } + /** * Prepared the connection for metadata operations. */ diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java index baa0ee2e9..18ac7cc65 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java @@ -42,6 +42,7 @@ public class SQLServerDictionary private static final Localizer _loc = Localizer.forPackage (SQLServerDictionary.class); + private String schemaCase = SCHEMA_CASE_PRESERVE; /** * Flag whether to treat UNIQUEIDENTIFIER as VARBINARY or VARCHAR */ @@ -230,4 +231,11 @@ public class SQLServerDictionary appendLength(buf, type); buf.append("')"); } + + /** + * Return DB specific schemaCase + */ + public String getSchemaCase() { + return schemaCase; + } }