@Where clause is ignored when eagerly loading ManyToOne association

Description

When loading an entity with an eager many-to-one association, and the associated entity is mapped with @Where(clause="..."), the where clause is not included in the SQL used to load the entity.

-------------------------------------------------------------------------------------------------------------------
Original description:

I have a bidirectional OneToMany relationship between Customer and Project entities. Both supports SOFT delete. When I load a Project, I can retrieve the Customer even if it was SOFT deleted. It only happens if the ManyToOne is EAGERly fetched.

I wrote a test case that shows the issue:

Create a Customer and a Project
SOFT Delete only the Customer
Fetch the Project
I except the Project to have no Customer since it was deleted.

https://stackoverflow.com/questions/47238458/where-annotation-with-manytoone-relationship-retrieves-soft-deleted-entity

Environment

None

Assignee

Gail Badner

Reporter

Sydney Henrard

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure