use of org.dbflute.cbean.sqlclause.orderby.OrderByClause in project dbflute-core by dbflute.
the class AbstractSqlClause method getOrderByClause.
// ===================================================================================
// OrderBy Clause
// ==============
// Clause Parts
public String getOrderByClause() {
reflectClauseLazilyIfExists();
final OrderByClause orderBy = getOrderBy();
String orderByClause = null;
if (hasUnionQuery()) {
final Map<String, String> selectClauseRealColumnAliasMap = getSelectClauseRealColumnAliasMap();
if (selectClauseRealColumnAliasMap.isEmpty()) {
String msg = "The selectClauseColumnAliasMap should not be empty when union query exists.";
throw new IllegalStateException(msg);
}
orderByClause = orderBy.getOrderByClause(selectClauseRealColumnAliasMap);
} else {
orderByClause = orderBy.getOrderByClause();
}
if (orderByClause != null && orderByClause.trim().length() > 0) {
return ln() + " " + orderByClause;
} else {
return orderByClause;
}
}
use of org.dbflute.cbean.sqlclause.orderby.OrderByClause in project dbflute-core by dbflute.
the class AbstractBehaviorReadable method helpSelectCursorCheckingOrderByPK.
protected void helpSelectCursorCheckingOrderByPK(CB cb, CursorSelectOption option) {
if (option.isOrderByPK()) {
final OrderByClause orderByClause = cb.getOrderByComponent();
final OrderByElement orderByFirstElement = orderByClause.getOrderByFirstElement();
if (orderByFirstElement == null || !orderByFirstElement.getColumnInfo().isPrimary()) {
String msg = "The cursor select by paging needs order by primary key: " + cb.asTableDbName();
throw new IllegalConditionBeanOperationException(msg);
}
}
}
Aggregations