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

Underscore in table name can result in SchemaExtractionException: More than one table found

Description

Suppose the schema or catalog contains two tables with similar names, eg an_entity and anoentity. When looking up table metadata via the JDBC metadata for the an_entity the underscore (single character wildcard) will cause two rows of metadata to be returned since the underlying metadata query seems to use a LIKE predicate and hence the wildcard matches both names.

The method
InformationExtractorJdbcDatabaseMetaDataImpl.processGetTableResults
will throw an error in the event that multiple rows are returned.

A test case is attached. Run first with hbm2ddl.auto to create and then setting to update will show the problem. The test case is in the form of an Eclipse Maven project.

I also have a suggested fix which I will submit, in which we find the row of metadata whose name actually matches that requested.

Environment

Tested on Oracle12, MySQL5.6

Status

Assignee

Andrea Boriero

Reporter

Richard Barnes

Fix versions

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

5.0.5
5.1.0

Priority

Minor