Named queries are a useful way to create reusable queries in the Repository Query API, so you do not have to build a new query object each time. Also, named queries let you specify precisely the SQL statements to be used by a query, rather than using the generalized SQL generated by the SQL repository. A named query is a Repository Query
or SQL statement that can be defined by the developer and be invoked by some String name.
The basic Query API requires you to create a Query
by calling several methods to create QueryExpressions
, and combine those QueryExpressions
into Query
objects. When you use named queries, after you have defined the query, you need to call only one method to execute the desired Query
. This can reduce object creation and simplify custom code.
Currently, named queries are supported in the SQL repository and the Integration Repository.