Search in sources :

Example 1 with SQLSerializer

use of com.querydsl.sql.SQLSerializer in project querydsl by querydsl.

the class AbstractSQLQuery method createQuery.

private Query createQuery(boolean forCount) {
    SQLSerializer serializer = new SQLSerializer(configuration);
    if (union != null) {
        serializer.serializeUnion(union, queryMixin.getMetadata(), unionAll);
    } else {
        serializer.serialize(queryMixin.getMetadata(), forCount);
    }
    // create Query
    if (logger.isDebugEnabled()) {
        logger.debug(serializer.toString());
    }
    Query query = persistenceManager.newQuery("javax.jdo.query.SQL", serializer.toString());
    orderedConstants = serializer.getConstants();
    queries.add(query);
    if (!forCount) {
        Expression<?> projection = queryMixin.getMetadata().getProjection();
        if (projection instanceof FactoryExpression) {
            this.projection = (FactoryExpression<?>) projection;
        }
    } else {
        query.setResultClass(Long.class);
    }
    return query;
}
Also used : FactoryExpression(com.querydsl.core.types.FactoryExpression) SQLSerializer(com.querydsl.sql.SQLSerializer) ProjectableSQLQuery(com.querydsl.sql.ProjectableSQLQuery) SQLQuery(com.querydsl.sql.SQLQuery) Query(javax.jdo.Query)

Example 2 with SQLSerializer

use of com.querydsl.sql.SQLSerializer in project querydsl by querydsl.

the class AbstractSQLQuery method toString.

@Override
public String toString() {
    if (!queryMixin.getMetadata().getJoins().isEmpty()) {
        SQLSerializer serializer = new SQLSerializer(configuration);
        serializer.serialize(queryMixin.getMetadata(), false);
        return serializer.toString().trim();
    } else {
        return super.toString();
    }
}
Also used : SQLSerializer(com.querydsl.sql.SQLSerializer)

Aggregations

SQLSerializer (com.querydsl.sql.SQLSerializer)2 FactoryExpression (com.querydsl.core.types.FactoryExpression)1 ProjectableSQLQuery (com.querydsl.sql.ProjectableSQLQuery)1 SQLQuery (com.querydsl.sql.SQLQuery)1 Query (javax.jdo.Query)1