@Override
    public ExplorerTreeNode getParent(final ExplorerTreeNode child) {
        final List<ExplorerTreeNode> parents = JooqUtil.contextResult(explorerDbConnProvider, context ->
                        context
                                .selectFrom(n)
                                .where(n.ID.in(context
                                        .select(p.ANCESTOR)
                                        .from(p)
                                        .where(p.DESCENDANT.eq(child.getId()))
                                        .and(p.DEPTH.eq(1))))
                                .fetch())
                .map(this::mapRecord);

        if (parents.size() == 1) {
            return parents.get(0);
        } else if (parents.size() == 0) {
            return null;
        } else {
            throw new IllegalArgumentException("More than one parent found: " + parents);
        }
    }
Get the root node containing a particular node, or the node itself if it is a root node.
stroom-explorer/stroom-explorer-impl-db/src/main/java/stroom/explorer/impl/db/ExplorerTreeDaoImpl.java