Example usage for javax.persistence.criteria CriteriaQuery toString

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

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

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 av  a  2s  .  co  m
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;
}