I was looking at the implementation of
Code:
public NameSpaceTablesInformation getTables(Identifier catalog, Identifier schema)
and
Code:
public TableInformation getTable(Identifier catalog, Identifier schema, Identifier tableName)
function and found a little bit of discrepancy in the implementation part. On looking at the comments, the way to go is:
// The table did not define an explicit namespace:
1) look in current namespace
2) look in default namespace
3) look in all namespaces - multiple hits is considered an error
I believe the same logic is also applied in
getTables(Identifier catalog, Identifier schema) function, except that the schemaFilter has been initialized to "" instead of null.
Please refer to this piece of code
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/InformationExtractorJdbcDatabaseMetaDataImpl.java#L320I checked the parameter definition of ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException
[url]https://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getTables(java.lang.String, java.lang.String, java.lang.String, java.lang.String[])[/url]
, which says
schemaPattern -
a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the searchsince the code checks for the condition that database support schemas, i think it should be initialized to null instead of "".
Let me know your thoughts.