CriteriaObjectInitializer is suboptimal when we query only one subtype of a hierarchy

Description

This is a followup of this Stackoverflow question: http://stackoverflow.com/questions/37894280/hibernate-search-mysql-error-too-many-joins-with-joined-inheritance-model .

When we query only one subtype of a hierarchy, CriteriaObjectInitializer creates a Criteria on the root type of the hierarchy while we could create a Criteria on the subtype only.

This would avoid a lot of joins when having a complex hierarchy.

Environment

None

Status

Assignee

Guillaume Smet

Reporter

Guillaume Smet

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Affects versions

Priority

Major
Configure