If you ever want to create an unique identifier for a node in JCR, you would’ve to add a mixin type [mix:referenceable] to it. Once you add this mixin, repository creates a UUID (Unique Idnetifier) for the node automatically.
- JCR query cheatsheet from Magnolia CMS
- Documentation from jboss modeshape.
- JCR2 spec on query from Adobe Day.