src/main/java/com/tri/persistence/jpql/QueryBuilder.java
public String render() {

		StringBuilder query = new StringBuilder();

		if (!select.isEmpty()) {
			query.append("SELECT ");
			query.append(StringUtils.join(select.items));
		}

		if (!deleteFrom.isEmpty()) {
			query.append("DELETE FROM ");
			query.append(deleteFrom.item);
		}

		if (!update.isEmpty()) {
			query.append("UPDATE ");
			query.append(update.item);

			if (!set.isEmpty()) {
				query.append(" SET ");
				query.append(StringUtils.join(set.items));
			}
		}

		if (!from.isEmpty()) {
			query.append(" FROM ");
			query.append(StringUtils.join(from.items));
		}

		if (!where.isEmpty()) {
			query.append(" WHERE ");
			query.append(where.render());
		}

		if (!group.isEmpty()) {
			query.append(" GROUP BY ");
			query.append(StringUtils.join(group.items));
		}

		if (order.isEmpty() == false) {
			query.append(" ORDER BY ");
			query.append(StringUtils.join(order.items));
		}

		return query.toString();

	}
public String render() {

		StringBuilder query = new StringBuilder();

		if (!select.isEmpty()) {
			query.append("SELECT ");
			query.append(StringUtils.join(select.items));
		}

		if (!deleteFrom.isEmpty()) {
			query.append("DELETE FROM ");
			query.append(deleteFrom.item);
		}

		if (!update.isEmpty()) {
			query.append("UPDATE ");
			query.append(update.item);

			if (!set.isEmpty()) {
				query.append(" SET ");
				query.append(StringUtils.join(set.items));
			}
		}

		if (!from.isEmpty()) {
			query.append(" FROM ");
			query.append(StringUtils.join(from.items));
		}

		if (!where.isEmpty()) {
			query.append(" WHERE ");
			query.append(where.render());
		}

		if (!group.isEmpty()) {
			query.append(" GROUP BY ");
			query.append(StringUtils.join(group.items));
		}

		if (order.isEmpty() == false) {
			query.append(" ORDER BY ");
			query.append(StringUtils.join(order.items));
		}

		return query.toString();

	}
Renders this object as JPQL query string.

@return the query as string