CriteriaAPI - Cannot use a not clause on a join, with explicit "on" argument

Description

Trying to use a negated predicate at a custom join @ the "ON" method, generates a ClassCastException

As an example, Having Stores and Books,

That query would Crash with

On AbstractJoinImpl.java:86 there's a Cast to AbstractPredicateImpl, but NegatedPredicateWrapper is not an child of AbstractPredicateImpl, thus failing the cast.

This affects any predicate that depends on a "not" clausule.

Environment

Hibernate 5.2.1
JDK 1.8.121
Windows 10 / OpenSuse42
MySql 5.5.31 / MariaDB 5.5.58

Assignee

Chris Cranford

Reporter

Xian Boullosa

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure