Example usage for javax.persistence.criteria CriteriaQuery getParameters

List of usage examples for javax.persistence.criteria CriteriaQuery getParameters

Introduction

In this page you can find the example usage for javax.persistence.criteria CriteriaQuery getParameters.

Prototype

Set<ParameterExpression<?>> getParameters();

Source Link

Document

Return the parameters of the query.

Usage

From source file:org.apache.openjpa.persistence.EntityManagerImpl.java

/**
 * Create a query from the given CritriaQuery.
 * Compile to register the parameters in this query.
 *///from   ww  w. j  ava2s  . com
public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery) {
    ((OpenJPACriteriaQuery<T>) criteriaQuery).compile();

    org.apache.openjpa.kernel.Query kernelQuery = _broker.newQuery(CriteriaBuilderImpl.LANG_CRITERIA,
            criteriaQuery);

    QueryImpl<T> facadeQuery = newQueryImpl(kernelQuery, null, _log).setId(criteriaQuery.toString());
    Set<ParameterExpression<?>> params = criteriaQuery.getParameters();

    for (ParameterExpression<?> param : params) {
        facadeQuery.declareParameter(param, param);
    }
    return facadeQuery;
}