In my A12 Java backend, I want to get all documents and their linked documents.
For this I created the following code:
QueryRoot query = QueryRoot.builder()
.targetDocumentModel(documentModelId)
.projectionName("document")
.constraint(ExactMatchOperator.builder()
.field(businessKeyFieldPath)
.value(businessKeyValue)
.build())
.exclude(false)
.link(QueryLink.builder()
.relationshipModel(relationshipModelId)
.targetRole(linkTargetRole)
.linkDocumentConstraint(ExactMatchOperator.builder()
.field(linkedDocBusinessKeyFieldPath)
.value(linkedDocBusinessKeyValue)
.build())
.build())
.paging(Paging.builder()
.pageSize(5)
.pageNumber(0)
.build())
.build();
QueryPage<DocumentTreeResult> queryResult = queryService.query(query, null);
However when I run this, I get the following error:
- path: $.links[0].linkDocumentConstraint message: | RM %s has no link document, so you can not query for this.
- How to interpret this error? Yes I don’t have any links right now, but then I expect an empty result, not an error!
- Why is the RM name not inserted? It is definitly set.