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;
}
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();
}
}
Aggregations