I have four tables:
RootNode // Will return multiple root nodes
SubNode // Will return one sub node per root node
SubNodeChildren1 // Will return multiple for e
In order to get the query working, I had to do an INNER JOIN FETCH
instead of a LEFT OUTER JOIN FETCH
on the eager entity:
SELECT rn FROM RootNode AS rn INNER JOIN FETCH rn.SubNode AS sn LEFT OUTER JOIN FETCH sn.SubNodeChildren1 LEFT OUTER JOIN FETCH sn.SubNodeChildren2 ...
To be honest, I'm still not exactly sure why it's working with an INNER JOIN FETCH
vs a LEFT OUTER JOIN FETCH
, but it definitely is working exactly as I need it to.