Types and methods for building queries
The following sections describe the major classes, interfaces, and methods that you use to build queries.
Types for building queries
The following Gosu types in the gw.api.database package provide
methods for building a query. Query,
Restriction, and Table all implement the ISelectQueryBuilder interface.
IQueryBeanResult implements
IQueryResult.
Type |
Description |
|---|---|
|
A class that represents a query that fetches entities or rows from the application database. |
|
An interface that represents a Boolean condition or conditions that restricts the set of items that a query fetches from the application database. |
|
An interface that represents an entity type that you add to the query with a join or a subselect. |
|
An interface that represents the results of a query that fetches entities from the application database. Adding sorting or filters to this item affects the query. |
|
An interface that represents the results of a query that fetches rows from the application database. Adding sorting or filters to this item affects the query. |
Methods on Query type for building queries
The following methods provide fundamental functionality for building queries. Other methods provide filtering to the query. To see information about methods that provide additional functionality, see the Javadoc. You can chain many of these methods to create concise code. For example, you can specify a query on an entity type, join to another entity type, and create the result set object by using a line like the following one:
var result = Query.make(Company).join(Company#PrimaryAddress).select()Method |
Description |
Returned object type |
|---|---|---|
|
Returns a table object with information from several entity types joined together in advanced ways. |
|
|
Static method on the Query class that creates a new query object. |
|
|
Defines the items to fetch from the application database, according to restrictions added to the query. Returns a result object that provides one of the following types of item:
|
|
|
Joins a dependent source. For example:
|
|
|
Combines all results from two queries into a single result. |
|
|
Whether to remove duplicate entity instances from the result. |
|
Methods on Result types for building queries
The following methods provide ordering functionality for building queries.
Other methods provide filtering to the result set. To see information about methods that provide additional functionality, see the Javadoc.
|
Method |
Description |
|---|---|
|
orderBy |
Clears all previous ordering, and then orders results by the specified column in ascending order. |
|
orderByDescending |
Clears all previous ordering, and then orders results by the specified column in descending order. |
|
thenBy |
Orders by the specified column in ascending order, without clearing previous ordering. |
|
thenByDescending |
Orders by the specified column in descending order, without clearing previous ordering. |
These ordering methods all take an object that implements the IQuerySelectColumn interface as their one
argument.
See also
