Bug 421555 - Schema information not displayed for SQL database
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/SimpleCatalogStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/SimpleCatalogStrategy.java
index 8d42d07..e5d7109 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/SimpleCatalogStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/SimpleCatalogStrategy.java
@@ -31,16 +31,36 @@
this.database = database;
}
- public boolean supportsCatalogs() {
- return true;
- }
-
@SuppressWarnings("unchecked")
- public List<Catalog> getCatalogs() {
- return this.database.getCatalogs();
- }
-
- public List<Schema> getSchemas() {
- return Collections.emptyList();
- }
+ public boolean supportsCatalogs() {
+ // DTP allows for optional support of catalogs in extensions
+ List<Catalog> catalogs = this.database.getCatalogs();
+ if ((catalogs == null) || catalogs.isEmpty()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Catalog> getCatalogs() {
+ List<Catalog> catalogs = this.database.getCatalogs();
+ // DTP allows for optional support of catalogs in extensions
+ if ((catalogs == null) || catalogs.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ return catalogs;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Schema> getSchemas() {
+ List<Catalog> catalogs = this.database.getCatalogs();
+ // if there are no catalogs, the database must hold the schemata directly
+ if ((catalogs == null) || catalogs.isEmpty()) {
+ return this.database.getSchemas();
+ }
+
+ return Collections.emptyList();
+ }
}