@Where annotation not working with entities that use inheritance

Description

Usage of the @Where annotation on a collection that contains entities that make use of JOINED inheritance strategy results in incorrect SQL.

Hibernate is assuming that the column specified in the @Where annotation will always be on the table that belongs to the entity in the collection, instead of also checking the super-class tables.

For example, consider the following data model and mapping code:

AbstractProjectVersion.java

ApplicationProjectVersion.java

Application.java

Loading Application will issue incorrect SQL, where PROJ_VSN_EFF_TO_DTM is being referenced on the DFIP_APPLN_PROJ_VERSION table, rather than its super-class (DFIP_PROJECT_VERSION).

A unit test demonstrating the issue is attached.

Environment

None

Status

Assignee

Unassigned

Reporter

Val Blant

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