| Vlad Mihalcea suggested of logging a ticket for this SO If've noticed, the QueryPlanCache was not used, if executing Spring-data -jpa findAll method with an EntityGraph annotation. I've added the EntityGraph annotations for performance reason's, but it turned out a performance loss: expensive HQL-Query parsing takes place every time the method is excuted.
private List<X> list() {
if (getEntityGraphQueryHint() != null) {
SessionImplementor sessionImpl = (SessionImplementor) getEntityManager().getSession();
HQLQueryPlan entityGraphQueryPlan = new HQLQueryPlan( getHibernateQuery().getQueryString(), false,
sessionImpl.getEnabledFilters(), sessionImpl.getFactory(), getEntityGraphQueryHint() );
unwrap( org.hibernate.internal.QueryImpl.class ).setQueryPlan( entityGraphQueryPlan );
}
return query.list();
}
A new HQLQueryPlan is created without checking the QueryPlanCache |