void addNamedQuery(
String name,
Query query
)
createNamedQuery
or createNamedStoredProcedureQuery
method. Any configuration of the query object (except for actual parameter binding) in effect when the named query is added is retained as part of the named query definition. This includes configuration information such as max results, hints, flush mode, lock mode, result set mapping information, and information about stored procedure parameters.
When the query is executed, information that can be set by means of the query APIs can be overridden. Information that is overridden does not affect the named query as registered with the entity manager factory, and thus does not affect subsequent query objects created from it by means of the createNamedQuery
or createNamedStoredProcedureQuery
method.
If a named query of the same name has been previously defined, either statically via metadata or via this method, that query definition is replaced.
- Parameters:
name
- name for the queryquery
- Query, TypedQuery, or StoredProcedureQuery object
- Since:
- JPA 2.1