I have four tables:
RootNode // Will return multiple root nodes SubNode // Will return one sub node per root node SubNodeChildren1 // Will return multiple for each sub node SubNodeChildren2 // Will return multiple for each sub node
and a similar object structure:
RootNode -> SubNode -> SubNodeChildren1 -> SubNodeChildren2
I need one query that will return all RootNodes to a table with initialized child elements SubNode and SubNode . SubNode look, but SubNode children SubNode lazy SubNode out.
I know how to write a query that will LEFT OUTER JOIN FETCH immediate children of the table and initialize them accordingly. However, I have no idea how to grab the children of a table that is impatiently posted from a top-level table.
I tried something like:
SELECT rn FROM RootNode AS rn LEFT OUTER JOIN FETCH rn.SubNode.SubNodeChildren1
but it always gives me an error that the owner is not part of the SELECT.
Any help is greatly appreciated.
sql hibernate hql
Stephen watkins
source share