hibernate.hbm2ddl.auto=update SQL2016 getTables() default Catalog

Description

o.h.tool.schema.extract.internal.InmformationExtractorJdbc#locateTableInNamespace()

On SQL2012 when no "catalog" or "hibernate.default_catalog" setting is configured anywhere.

This is causing the catalog==null to be converted into catalogFilter="" because #supportsCatalogs() returns true.

But you are not allowed to supply a blank string as a value here for the JDBC driver getTables() API. Since it will try to match that as the catalog name, you should be supplying an SQL NULL value here instead.

As per https://msdn.microsoft.com/en-GB/library/ms186250.aspx

Also see DB_NAME() if you need to supply a default value and need the current database.
https://msdn.microsoft.com/en-gb/library/ms189753.aspx

Really if you need to know an actual catalog name to use you should be calling DB_NAME() to get it, when there is no explicit configuraiton setting specifuying it. Such as hibernate.properties or associate with the specific entity.

Environment

None

Status

Assignee

Gail Badner

Reporter

Darryl Miles

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure