Wrong SQL generated for HQL subquery referencing a superclass property in joined inheritance schema in Hibernate

Solution In Progress - Updated -

Issue

  • An entity (e.g. Employee) extends a superclass (Person) in an InheritanceType.JOINED hierarchy
  • A superclass property (e.g. Person.firstName) is referenced in an HQL subquery involving the subclass

    ... where exists (select employee from company.employees as employee where lower(employee.firstName) like :param1 ...
    
  • The generated SQL references a non-existent join (the subclass/superclass table join is missing but referenced)

    ... where exists (select employees1_.id from Employee employees1_ where ... lower(employees1_1_.firstName) ...
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6
    • 7
  • Hibernate
    • 4
    • 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content