mirror of https://github.com/apache/openjpa.git
Simple change to stringify a collection of values with proper spaces
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1456576 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0f4459fcb4
commit
e617abd086
|
@ -23,6 +23,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -669,24 +670,25 @@ class CriteriaQueryImpl<T> implements OpenJPACriteriaQuery<T>, AliasContext {
|
||||||
if (_where != null) {
|
if (_where != null) {
|
||||||
buffer.append(" WHERE ").append(_where.asValue(this));
|
buffer.append(" WHERE ").append(_where.asValue(this));
|
||||||
}
|
}
|
||||||
if (_orders != null) {
|
renderList(buffer, " ORDER BY ", getOrderList());
|
||||||
buffer.append(" ORDER BY ");
|
renderList(buffer, " GROUP BY ", getGroupList());
|
||||||
for (Order orderBy : getOrderList()) {
|
|
||||||
buffer.append(((CriteriaExpression)orderBy).asValue(this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_groups != null) {
|
|
||||||
buffer.append(" GROUP BY ");
|
|
||||||
for (Expression<?> groupBy : getGroupList()) {
|
|
||||||
buffer.append(((CriteriaExpression)groupBy).asValue(this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_having != null) {
|
if (_having != null) {
|
||||||
buffer.append(" HAVING ");
|
buffer.append(" HAVING ");
|
||||||
buffer.append(_having.asValue(this));
|
buffer.append(_having.asValue(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renderList(StringBuilder buffer, String clause, Collection<?> coll) {
|
||||||
|
if (coll == null || coll.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
buffer.append(clause);
|
||||||
|
for (Iterator<?> i = coll.iterator(); i.hasNext(); ) {
|
||||||
|
buffer.append(((CriteriaExpression)i.next()).asValue(this));
|
||||||
|
if (i.hasNext()) buffer.append(", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void renderJoins(StringBuilder buffer, Collection<Join<?,?>> joins) {
|
private void renderJoins(StringBuilder buffer, Collection<Join<?,?>> joins) {
|
||||||
if (joins == null) return;
|
if (joins == null) return;
|
||||||
for (Join j : joins) {
|
for (Join j : joins) {
|
||||||
|
|
Loading…
Reference in New Issue