Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Dynamic and EJB query > Develop applications that use EJB query > EJB query language
ORDER BY clause
The ORDER BY clause specifies an ordering of the objects in the result collection
Use the syntax:
ORDER BY [ order_element ,]* order_element order_element ::= { path-expression | integer } [ ASC | DESC ]The path expression must specify a single valued field that is a primitive type of byte, short, int, long, float, double, char or a wrapper type of Byte, Short, Integer, Long, Float, Double, BigDecimal, String, Character, java.util.Calendar, java.util.Date, java.sql.Date, java.sql.Time, java.sql.Timestamp.
ASC specifies ascending order and is the default. DESC specifies descending order.
Integer refers to a selection expression in the SELECT clause.
Example: ORDER BY clause
Return department objects in decreasing deptno order:
SELECT OBJECT(d) FROM DeptBean d ORDER BY d.deptno DESCReturn employee objects sorted by department number and name:
SELECT OBJECT(e) FROM EmpBean e ORDER BY e.dept.deptno ASC, e.name DESC
EJB query language
Use EJB query
Use the dynamic query service