I have the following JCR SQL 2 query:
SELECT * FROM [nt:unstructured] as node
WHERE isDescendantNode(node, '/content/some/root/path')
AND # EXTRA CONDITIONS
and the result set, along with a bunch of nt:unstructured nodes, returns a lot of nodes with the cq:PageContent primary type. When inspected in CRX DE, it's clear that their jcr:primaryType is cq:PageContent, not nt:unstructured
Why is this happening?
Each node type in JCR can have supertypes.
which can be organised into an inheritance hierarchy.
In case of this particular query, where the
nt:unstructurednode type is used,cq:PageContentnodes appear in the result set because theirjcr:primaryTypeis a subtype ofnt:unstructured.This is described in the documentation for AEM custom node types.
The query, depending on the other conditions, is likely to return nodes with other types explicitly listed as the
jcr:primaryType, which also inherit fromnt:unstructured. Some examples include:cq:EditConfig,dam:AssetContent,cq:LiveSyncActionand many more.