Currently, the entity query plan is resolved twice for every query. First, when getting the {{ParameterMetadata}::
final QueryImpl query = new QueryImpl(
this,
getQueryPlan( queryString, false ).getParameterMetadata(),
queryString
);
Second, in resultClassChecking:
final HQLQueryPlan queryPlan = getFactory().getQueryPlanCache().getHQLQueryPlan(
hqlQuery.getQueryString(),
false,
getLoadQueryInfluencers().getEnabledFilters()
);
If we add the QueryPlan to the QueryImpl we could get it without resolving it in resultClassChecking. |