We're updating the issue view to help you get more done. 

Database name not quoted at schema update

Description

The database schema update fails on a Microsoft SQL-Server 2008 (and probably newer versions and other database types too) if the database name contains a hyphen. In that case the SQL-Server expects the database name part inside the full qualified table name to be quoted. Example:
Does not work:
alter table serie-m.paul.TEST add [C1] varchar(255)
Works:
alter table "serie-m".paul.TEST add [C1] varchar(255)

Setting property hibernate.globally_quoted_identifiers=true does not help, at schema update the code in org.hibernate.mapping.Table#sqlAlterStrings (line 450) still gets the qualified table name wrong, because TableInformationImp#tableName provides it without quotes, likely because its' identifierHelper (which has NormalizingIdentifierHelperImpl#globallyQuoteIdentifiers = true) is not used at #getName().

Attached test case can be used to reproduce the problem, after adapting the settings to connect to a Microsoft SQL-Server with a hyphen in the database name.

Environment

Microsoft SQL-Server with a database which contains a hyphen in the name

Status

Assignee

Vlad Mihalcea

Reporter

grischa paul

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

3.3.2

Components

Affects versions

5.2.12

Priority

Major