alfresco-developer-series icon indicating copy to clipboard operation
alfresco-developer-series copied to clipboard

Querying against properties in multiple aspects

Open jpotts opened this issue 5 years ago • 1 comments

In the tutorial content there is some discussion about querying across properties that reside in multiple aspects. The text implies that it is not supported or that it is difficult to do and then shows an alternative that uses sub-selects. This is misleading as it is possible to do multiple joins to query across multiple aspects.

jpotts avatar Apr 30 '20 15:04 jpotts

Yes, indeed, it works perfectly.

A sample query I used in my own custom project:

SELECT doc.*, cli.*, dono.*, tipo.*, iddoc.*, data.* 
FROM nexo:documentoEHS as doc  
JOIN nexo:idCliente as cli ON cli.cmis:objectId = doc.cmis:objectId  
JOIN nexo:donoDocumento as dono ON dono.cmis:objectId = doc.cmis:objectId  
JOIN nexo:tipoDocumento as tipo ON tipo.cmis:objectId = doc.cmis:objectId  
JOIN nexo:idDocumento as iddoc ON iddoc.cmis:objectId = doc.cmis:objectId  
JOIN nexo:dataDocumento as data ON data.cmis:objectId = doc.cmis:objectId  
WHERE cli.nexo:idCliente = 'clientenovo'  AND tipo.nexo:idTipoDocumento = 10

As you can see, lots of aspects, and the WHERE clause has conditions in two of them.

douglascrp avatar May 01 '20 17:05 douglascrp