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

Gail Badner gbadner at redhat.com
Fri Dec 16 19:06:15 EST 2016

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).



[1] https://github.com/hibernate/hibernate-orm/pull/1707

More information about the hibernate-dev mailing list