NamedQueries not picking up the schema name associated with the entity

Description

I tried to upgrade the hibernate version from 4.3.11 to 5.2.2.

My company's project has multiple schemas for the different projects but they all use the same configuration file for datasource connection and entities are marked with @Table annotation with the specified schema name for mysql.

After upgrading to hibernate 5, while executing a named query the schema it refers to is the default schema from the jdbc connection url not from the schema attribute of the table annotation. The code is working fine with Hibernate 4.

Environment

Hibernate 5.2.2. Database Mysql 5

Assignee

Unassigned

Reporter

Opas Gil

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure