Generating table alias names missing, when column name starts with an underscore.

Description

When generating table alias names, if the column in a @Where clause starts with an underscore, then the alias for the table is omitted from the query.

Generated query:

Hibernate:

Column column1 is missing the lines1 alias.

Where this is really a problem is when you have a relationship like the following:

Generated query:

Hibernate:

Both _column1 are missing their alias and cause the following exception:

SQL error or missing database (ambiguous column name: _column1)

Most people don't use underscore's in their table names. I am working with a database where ALL primary keys to the tables start with underscore and I have to jump through modeling hoops in order to get these to work.

Please see the github repository dedicated to this issue with multiple examples:

https://github.com/oblodgett/HibernateHelloWorld

This issue might be linked to HHH-2022, and but seems to be a distinct issue on its own.

Environment

Hibernate-core, Postgres, Sqlite

Status

Assignee

Unassigned

Reporter

Olin Blodgett

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure