[hibernate-dev] EntityGraph query spaces not applied to Query (HHH-11213)

Steve Ebersole steve at hibernate.org
Fri Dec 16 20:03:38 EST 2016

It likely is not an issue.  Query spaces only come into play with regards
to restrictions.  Since the EntityGraph is not part of the query proper
restrictions cannot be based on it.

That would be a scenario to try though... create a query restricting
results based on some joined attribute and then supply an EntityGraph hint
for that attribute.  But IMO that is a completely contrived scenario.

On Fri, Dec 16, 2016, 6:09 PM Gail Badner <gbadner at redhat.com> wrote:

> Query spaces for EntityGraph nodes/subgraphs are not currently added
> when applied to a Query, and so the session is not flushed if it
> contains updated data relevant to the EntityGraph that is not in the
> query spaces defined for the Query.
> I originally though this was a critical issue, but now that I'm
> looking into it, I'm not so sure. I am having a hard time coming up
> with a test case where it matters.
> I've created a pull request with the test case attached to HHH-11213,
> with some added checks to detect if the session flushes. [1]
> In this case, the session does not flush, but the query results are
> still correct because the updated entity is taken from the Session,
> not from the ResultSet returned by the query.
> I wonder now if it really is necessary to flush the Session when the
> session has updates that apply *only* to the EntityGraph (and not to
> the base Query).
> Thoughts?
> Thanks,
> Gail
> [1] https://github.com/hibernate/hibernate-orm/pull/1707
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

More information about the hibernate-dev mailing list