public class SqlOrder extends Object
For example there's a table PERSON with two columns - ID and NAME. The META SQL query can be the next one:
ALL_PEOPLE(QRY)=
select ID @id, NAME @name
from PERSON
{= where
{& id=:id}
{& UPPER(name)=:+name}
}
{#1 order by ID}
{#2 order by NAME}
;
In the case of the SQL Processor invocation
SqlEngine sqlEngine = sqlLoader.getQueryEngine("ALL_PEOPLE");
List<Person> list = sqlEngine.query(session, Person.class, null, SqlOrder.getAscOrder(1));
the output list is sorted in ascending order based on the column ID.
In the case of the SQL Processor invocation
SqlEngine sqlEngine = sqlLoader.getQueryEngine("ALL_PEOPLE");
List<Person> list = sqlEngine.query(session, Person.class, new Object(), SqlOrder.getDescOrder(2));
the output list is sorted in descending order based on the column NAME.
For more info please see the Tutorials.
| Modifier and Type | Class and Description |
|---|---|
static class |
SqlOrder.Order
The enumeration for the ordering directives.
|
| Modifier and Type | Field and Description |
|---|---|
private SqlOrder.Order |
orderDirection
The ordering direction (no ordering, ascending or descending).
|
private String |
orderId
The ordering id.
|
private List<SqlOrder> |
orders
The list of all ordering directives.
|
| Modifier | Constructor and Description |
|---|---|
private |
SqlOrder()
Creates a new empty ordering directive list.
|
private |
SqlOrder(String orderId,
SqlOrder.Order orderDirection)
Creates a new ordering directive list.
|
| Modifier and Type | Method and Description |
|---|---|
SqlOrder |
addAscOrder(int orderId)
Adds one more ascending ordering directive into the list of ordering directives.
|
SqlOrder |
addAscOrder(String orderId)
Adds one more ascending ordering directive into the list of ordering directives.
|
SqlOrder |
addAscOrderNullsLast(int orderId)
Adds one more ascending ordering directive into the list of ordering directives.
|
SqlOrder |
addAscOrderNullsLast(String orderId)
Adds one more ascending ordering directive into the list of ordering directives.
|
SqlOrder |
addDescOrder(int orderId)
Adds one more descending ordering directive into the list of ordering directives.
|
SqlOrder |
addDescOrder(String orderId)
Adds one more descending ordering directive into the list of ordering directives.
|
SqlOrder |
addDescOrderNullsFirst(int orderId)
Adds one more descending ordering directive into the list of ordering directives.
|
SqlOrder |
addDescOrderNullsFirst(String orderId)
Adds one more descending ordering directive into the list of ordering directives.
|
SqlOrder |
addOrder(int orderId)
Adds one more ascending or descending ordering directive into the list of ordering directives.
|
static SqlOrder |
getAscOrder(int orderId)
The factory method.
|
static SqlOrder |
getAscOrder(String orderId)
The factory method.
|
static SqlOrder |
getAscOrderNullsLast(int orderId)
The factory method.
|
static SqlOrder |
getAscOrderNullsLast(String orderId)
The factory method.
|
static SqlOrder |
getDescOrder(int orderId)
The factory method.
|
static SqlOrder |
getDescOrder(String orderId)
The factory method.
|
static SqlOrder |
getDescOrderNullsFirst(int orderId)
The factory method.
|
static SqlOrder |
getDescOrderNullsFirst(String orderId)
The factory method.
|
static SqlOrder |
getOrder()
The factory method.
|
static SqlOrder |
getOrder(int orderId)
The factory method.
|
SqlOrder.Order |
getOrderDirection()
Returns the ordering direction (no ordering, ascending or descending).
|
String |
getOrderId()
Returns the ordering id.
|
List<SqlOrder> |
getOrders()
Returns the list of ordering directives.
|
String |
toString()
For debug purposes.
|
private String orderId
private SqlOrder.Order orderDirection
private SqlOrder()
private SqlOrder(String orderId, SqlOrder.Order orderDirection)
orderId - the ordering idorderDirection - the ordering directionpublic static SqlOrder getOrder()
public static SqlOrder getAscOrder(int orderId)
orderId - the ordering idpublic static SqlOrder getAscOrderNullsLast(int orderId)
orderId - the ordering idpublic static SqlOrder getAscOrder(String orderId)
orderId - the ordering idpublic static SqlOrder getAscOrderNullsLast(String orderId)
orderId - the ordering idpublic static SqlOrder getDescOrder(int orderId)
orderId - the ordering idpublic static SqlOrder getDescOrderNullsFirst(int orderId)
orderId - the ordering idpublic static SqlOrder getDescOrder(String orderId)
orderId - the ordering idpublic static SqlOrder getDescOrderNullsFirst(String orderId)
orderId - the ordering idpublic static SqlOrder getOrder(int orderId)
orderId - the ordering id. Can be a negative one for a descending ordering directive.public SqlOrder addAscOrder(int orderId)
orderId - the ordering idpublic SqlOrder addAscOrderNullsLast(int orderId)
orderId - the ordering idpublic SqlOrder addAscOrder(String orderId)
orderId - the ordering idpublic SqlOrder addAscOrderNullsLast(String orderId)
orderId - the ordering idpublic SqlOrder addDescOrder(int orderId)
orderId - the ordering idpublic SqlOrder addDescOrderNullsFirst(int orderId)
orderId - the ordering idpublic SqlOrder addDescOrder(String orderId)
orderId - the ordering idpublic SqlOrder addDescOrderNullsFirst(String orderId)
orderId - the ordering idpublic SqlOrder addOrder(int orderId)
orderId - the ordering id. Can be a negative one for a descending ordering directive.public String getOrderId()
public SqlOrder.Order getOrderDirection()
public List<SqlOrder> getOrders()
Copyright © 2016. All rights reserved.