Underscore in table name gives "Table not found" log

Description

When I deploy my application in WildFly, I get a bunch of log statements from hibernate for tables with underscore in the name:

2016-05-03 11:39:25,344 INFO [org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl] (ServerService Thread Pool – 61) HHH000262: Table not found: AAA_BBB

I've investigated a bit and found that it is due to the usage of sp_tables. This (which is what Hibernate uses) does not work:

exec sp_tables N'AAA_BBB',N'',N'MyDb',N'''''''TABLE'''',''''VIEW''''''', @fUsePattern = 1

This however, works:

exec sp_tables N'AAA_BBB',N'',N'MyDB',N'''''''TABLE'''',''''VIEW''''''', @fUsePattern = 0

Environment

WildFly 10.0.0.Final
Microsoft SQL Server 2012

Activity

Show:
Andrea Boriero
May 11, 2016, 5:54 PM

Hi ,

can you provide a test that reproduce the issue?

Thanks

Steve Ebersole
May 11, 2016, 7:44 PM

Hibernate does not use sp_tables. Hibernate simply uses the capabilities provided by JDBC; your driver is simply forwarding that as a call to sp_tables.

Use of database vendor specific schema metadata schema or props is beyond the scope of Hibernate. We do however offer pluggable extension points allowing you to tell Hibernate a different way to obtain the necessary information an alternative way.

Assignee

Unassigned

Reporter

JacobC

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure