6.6.9 QueryManager

The QueryManager object provides methods for creating queries, retrieving saved queries and for discovering supported query languages:

javax.jcr.query.
QueryManager

Query

createQuery(String statement,
String language)

Creates a new query by specifying the query statement itself and the language in which the query is stated. If the query statement is syntactically invalid, given the language specified, an InvalidQueryException is thrown. The language parameter must be a string from among those returned by QueryManager.getSupportedQueryLanguages(); if it is not, then an InvalidQueryException is thrown.

A RepositoryException is thrown if another error occurs.

Query

getQuery(Node node)

Retrieves an existing persistent query. If node is not a valid persisted query (that is, a node of type nt:query), an InvalidQueryException is thrown.

Persistent queries are created by first using QueryManager.createQuery to create a Query object and then calling Query.save to persist the query to a location in the workspace.

A RepositoryException is thrown if another error occurs.

String[]

getSupportedQueryLanguages()

Returns an array of strings identifying the supported query languages. In level 1 this set must include the string represented by the constant Query.XPATH. If SQL is supported it must additionally include Query.SQL. An implementation of either level may also support other languages.

A RepositoryException is thrown if an error occurs.