parameterized NXQL queries

We have nuxeo queries which come from a constants file. A sample query is listed below.

public static final String GET_FILES_BY_PARENT =“SELECT * FROM File WHERE ecm:parentId = ?”

OR

public static final String GET_FILES_BY_PARENT =“SELECT * FROM File WHERE ecm:parentId = :parentID”

How can I plugin in the parameters while excuting the query. We execute the query in the following manner.

Documents docs = (Documents) session.newRequest(“Document.Query”).set(“query”, GET_FILES_BY_PARENT).execute();

We can have more than one parameter in a query. How can we parameterize the query without ugly string manipulations.

Thanks

0 votes

1 answers

1880 views

ANSWER



It seems you're using Nuxeo Client and not coding server-side code.

I'm not aware of any helper to build parametrized queries for Nuxeo Client. On the server side there's NXQLQueryBuilder.

0 votes