Invalid Pagination COUNT query generated with @Inheritance(strategy = InheritanceType.JOINED)

Description

This bug might be related to https://hibernate.atlassian.net/browse/HHH-13712

  • Whats the issue?*
    If you run the http://localhost:8080/subobj, the select query generates fine. But the count query doesn't contain JOIN statement so making the ' where ( subobject0_1_.DELETED = 0)' clause invalid.

Which results in following exception:


How to reproduce:
Clone and run https://github.com/gtiwari333/hibernate-inheritance-JOINED-with-where-bug then open http://localhost:8080/subobj on your browser

Notes:

AST for select query

AST for count query

Environment

None

Activity

Show:
Christian Beikov
July 23, 2020, 10:29 AM

I attached a reproducer. This is in fact an issue with determining the participating tables. I’ll check what I can do about this.

Christian Beikov
July 23, 2020, 10:32 AM

In the meantime you can disable this optimization by setting the property hibernate.query.omit_join_of_superclass_tables to false

Christian Beikov
July 23, 2020, 10:48 AM

Would be awesome if you could check whether the following PR fixes your issue:

Assignee

Christian Beikov

Reporter

Ganesh Tiwari

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure