Schema name with dash causes errors for Hibernate hbm2ddl.auto

Description

I'm working with hibernate.hbm2ddl.auto=update in development environments and recently I've upgraded hibernate version from 5.1.0.Final to 5.2.X.Final and I've started to experience errors in hibernate's auto generated commands for my schema called portal-appname.

In hibernate 5.1.0 when I add a new column for a given table the following command its executed:

Hibernate: alter table answer add column fake integer not null

But in Hibernate 5.2.X, the schema is added as a prefix to the given tablename:

Hibernate: alter table portal-appname.answer add column fake integer not null

This is not a valid sql command, obviously:

MySQL server version for the right syntax to use near '-appname.answer add column fake integer not null' at line 1

Hibernate should enclose portal-appname.table with backtips automatically as:

Hibernate: alter table `portal-appname`.`answer` add column fake integer not null

I've tried with hibernate.globally_quoted_identifiers but it only quotes column names but not the portal-appname.table pair.

Funny thing is that hibernate 5.2.X is only using that syntax with column names, but it's not prefixing the schema in other kind of alters such as:

Hibernate: alter table tablename add constraint FKftsiakun1f5qp01aabdw887kp foreign key (logo) references tablename2 (id)

Environment

Hibernate 5.2.10.Final
MySQL 5.6
Windows 10 and Mac OS X 10.12.4

Assignee

Andrea Boriero

Reporter

Miguel Martín-Forero

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.1.0

Affects versions

Priority

Major
Configure