Package com.anylogic.engine.database
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- getDSLQuery
- list
- list
- getSQL
- getResults
- count
- count
- distinct
- exists
- hasResults
- hasResults
- fullJoin
- fullJoin
- groupBy
- groupBy
- innerJoin
- innerJoin
- join
- join
- leftJoin
- leftJoin
- limit
- list
- offset
- on
- on
- orderBy
- orderBy
- rightJoin
- rightJoin
- where
- where
- firstResult
- uniqueResult
- firstResult
- uniqueResult
- firstResult
- firstResult
- uniqueResult
- uniqueResult
- firstResult
- firstResult
- uniqueResult
- uniqueResult
- tableFunction
- arrayOfDouble
- arrayOfInt
- java.lang.Object
- com.anylogic.engine.database.SelectQuery
public class SelectQuery extends Object
SelectQuery for building and execution of SELECT SQL statements
Constructor | Description |
---|---|
SelectQuery |
Modifier and Type | Method | Description |
---|---|---|
double[] | arrayOfDouble |
Executes the given SELECT query which should return 1 column with numbers.
|
int[] | arrayOfInt |
Executes the given SELECT query which should return 1 column with numbers.
|
long | count() |
This function caches its results, to speed up default behavior
Use count(false) to get non cached result every time
|
long | count | |
SelectQuery | distinct() |
Set the SelectQuery to return distinct results
|
com.querydsl.core.types.dsl.BooleanExpression | exists() |
Exists is used to test for the existence of any record in a subquery.
|
com.querydsl.core.Tuple | firstResult |
Returns first result for the given SelectQuery or null if no result is found
This function caches its results, to speed up default behavior
Use firstResult(columns) to get non cached result every time
|
<RT> RT | firstResult |
Returns first result for the given SelectQuery or null if no result is found
|
<RT, | firstResult |
Returns first result for the given SelectQuery or null if no result is found
|
com.querydsl.core.Tuple | firstResult |
Returns first result for the given SelectQuery or null if no result is found
This function caches its results, to speed up default behavior
Use firstResult(columns) to get non cached result every time
|
<RT> RT | firstResult |
Returns first result for the given SelectQuery or null if no result is found
This function caches its results, to speed up default behavior
Use firstResult(false, column) to get non cached result every time
|
<RT, | firstResult |
Returns first result for the given SelectQuery or null if no result is found
This function caches its results, to speed up default behavior
Use firstResult(false, column, returnType) to get non cached result every time
|
SelectQuery | fullJoin |
Adds a full join to query
|
<E> SelectQuery | fullJoin |
Adds a full join to query
|
com.querydsl.sql.SQLQuery<com.querydsl.core.Tuple> | getDSLQuery() | |
ResultSet | getResults |
Get the results as an JDBC result set
|
com.querydsl.sql.SQLBindings | getSQL |
Get the query as an SQL query string and parameters
|
SelectQuery | groupBy |
Defines GROUP BY statement column
|
SelectQuery | groupBy |
Defines GROUP BY statement columns
|
boolean | hasResults() |
This function caches its results, to speed up default behavior
Use exists(false) to get non cached result every time
|
boolean | hasResults | |
SelectQuery | innerJoin |
Adds an inner join to query
|
<E> SelectQuery | innerJoin |
Adds an inner join to query
|
SelectQuery | join |
Adds a join to query
|
<E> SelectQuery | join |
Adds a join to query
|
SelectQuery | leftJoin |
Adds a left join to query
|
<E> SelectQuery | leftJoin |
Adds a left join to query
|
SelectQuery | limit |
Defines the maximum number of rows for the selection results
|
List<com.querydsl.core.Tuple> | list() |
List the results for columns of origin table we select from
An empty list is returned for no results.
|
List<com.querydsl.core.Tuple> | list |
List the results for given columns of SelectQuery
An empty list is returned for no results.
|
<RT> List<RT> | list |
List the results for given column of SelectQuery
An empty list is returned for no results.
|
SelectQuery | offset |
Defines the offset for the selection results
|
SelectQuery | on |
Defines a condition to the last added join
|
SelectQuery | on |
Defines a conditions to the last added join
|
SelectQuery | orderBy |
Defines ORDER BY specifier
|
SelectQuery | orderBy |
Defines ORDER BY specifiers
|
SelectQuery | rightJoin |
Adds a right join to query
|
<E> SelectQuery | rightJoin |
Adds a right join to query
|
TableFunction | tableFunction |
Executes the given SELECT query which should return 2 columns of data:
the first column contains arguments numbers,
the second column contains values numbers.
|
com.querydsl.core.Tuple | uniqueResult |
Returns a unique result for the given SelectQuery
This function caches its results, to speed up default behavior
Use uniqueResult(columns) to get non cached result every time
|
<RT> RT | uniqueResult |
Returns an unique result for the given SelectQuery
|
<RT, | uniqueResult |
Returns an unique result for the given SelectQuery
|
com.querydsl.core.Tuple | uniqueResult |
Returns a unique result for the given SelectQuery
This function caches its results, to speed up default behavior
Use uniqueResult(columns) to get non cached result every time
|
<RT> RT | uniqueResult |
Returns an unique result for the given SelectQuery
This function caches its results, to speed up default behavior
Use uniqueResult(false, column) to get non cached result every time
|
<RT, | uniqueResult |
Returns an unique result for the given SelectQuery
This function caches its results, to speed up default behavior
Use uniqueResult(false, column, returnType) to get non cached result every time
|
SelectQuery | where |
Add condition for selection results
|
SelectQuery | where |
Add conditions for selection results
|
@AnyLogicInternalAPI public SelectQuery(ModelDatabase database, com.querydsl.sql.RelationalPathBase<?> table, Utilities owner)
@AnyLogicInternalAPI public com.querydsl.sql.SQLQuery<com.querydsl.core.Tuple> getDSLQuery()
public List<com.querydsl.core.Tuple> list()
List the results for columns of origin table we select from
An empty list is returned for no results.
- Returns:
- List
list of resulting tuples that contain according values
public <RT> List<RT> list(com.querydsl.core.types.Expression<RT> column)
List the results for given column of SelectQuery
An empty list is returned for no results.
- Parameters:
column
- resulting column- Returns:
- List
public com.querydsl.sql.SQLBindings getSQL(com.querydsl.core.types.Expression<?>... columns)
Get the query as an SQL query string and parameters
- Parameters:
columns
- to select- Returns:
- SQLBindings containing SQL query string and its parameters
public ResultSet getResults(com.querydsl.core.types.Expression<?>... columns)
Get the results as an JDBC result set
- Parameters:
columns
- to select- Returns:
- selected ResultSet
public long count()
This function caches its results, to speed up default behavior
Use count(false) to get non cached result every time
- Returns:
- number of rows matching the given criteria
public long count(boolean cached)
- Parameters:
cached
- if true, then this method will try to use cached values to avoid database access- Returns:
- number of rows matching the given criteria
public SelectQuery distinct()
Set the SelectQuery to return distinct results
- Returns:
- SelectQuery
public com.querydsl.core.types.dsl.BooleanExpression exists()
Exists is used to test for the existence of any record in a subquery.
To check that there are rows with the given select criteria use
hasResults()
- Returns:
- BooleanExpression
public boolean hasResults()
This function caches its results, to speed up default behavior
Use exists(false) to get non cached result every time
- Returns:
true
, if at least one row matching the given criteria exists, otherwisefalse
public boolean hasResults(boolean cached)
- Parameters:
cached
- if true, then this method will try to use cached values to avoid database access- Returns:
true
, if at least one row matching the given criteria exists, otherwisefalse
public SelectQuery fullJoin(com.querydsl.core.types.EntityPath<?> table)
Adds a full join to query
- Parameters:
table
- table to join- Returns:
- SelectQuery
public <E> SelectQuery fullJoin(com.querydsl.sql.ForeignKey<E> key, com.querydsl.sql.RelationalPath<E> table)
Adds a full join to query
- Parameters:
key
- foreign key to make jointable
- table to join- Returns:
- SelectQuery
public SelectQuery groupBy(com.querydsl.core.types.Expression<?>... columns)
Defines GROUP BY statement columns
- Parameters:
columns
- for grouping- Returns:
- SelectQuery
public SelectQuery groupBy(com.querydsl.core.types.Expression<?> column)
Defines GROUP BY statement column
- Parameters:
column
- for grouping- Returns:
- SelectQuery
public SelectQuery innerJoin(com.querydsl.core.types.EntityPath<?> table)
Adds an inner join to query
- Parameters:
table
- table to join- Returns:
- SelectQuery
public <E> SelectQuery innerJoin(com.querydsl.sql.ForeignKey<E> key, com.querydsl.sql.RelationalPath<E> table)
Adds an inner join to query
- Parameters:
key
- foreign key to make jointable
- table to join- Returns:
- SelectQuery
public SelectQuery join(com.querydsl.core.types.EntityPath<?> table)
Adds a join to query
- Parameters:
table
- table to join- Returns:
- SelectQuery
public <E> SelectQuery join(com.querydsl.sql.ForeignKey<E> key, com.querydsl.sql.RelationalPath<E> table)
Adds a join to query
- Parameters:
key
- foreign key to make jointable
- table to join- Returns:
- SelectQuery
public SelectQuery leftJoin(com.querydsl.core.types.EntityPath<?> table)
Adds a left join to query
- Parameters:
table
- table to join- Returns:
- SelectQuery
public <E> SelectQuery leftJoin(com.querydsl.sql.ForeignKey<E> key, com.querydsl.sql.RelationalPath<E> table)
Adds a left join to query
- Parameters:
key
- foreign key to make jointable
- table to join- Returns:
- SelectQuery
public SelectQuery limit(long limit)
Defines the maximum number of rows for the selection results
- Parameters:
limit
- maximum number of rows- Returns:
- SelectQuery
public List<com.querydsl.core.Tuple> list(com.querydsl.core.types.Expression<?>... columns)
List the results for given columns of SelectQuery
An empty list is returned for no results.
- Parameters:
columns
- resulting columns- Returns:
- List
list of resulting tuples that contain according values
public SelectQuery offset(long offset)
Defines the offset for the selection results
- Parameters:
offset
-- Returns:
- SelectQuery
public SelectQuery on(com.querydsl.core.types.Predicate... conditions)
Defines a conditions to the last added join
- Parameters:
conditions
-- Returns:
- SelectQuery
public SelectQuery on(com.querydsl.core.types.Predicate condition)
Defines a condition to the last added join
- Parameters:
conditions
-- Returns:
- SelectQuery
public SelectQuery orderBy(com.querydsl.core.types.OrderSpecifier<?>... orderSpecifiers)
Defines ORDER BY specifiers
- Parameters:
orderSpecifiers
- order specifiers ( example: db_table.db_column.asc() )- Returns:
- SelectQuery
public SelectQuery orderBy(com.querydsl.core.types.OrderSpecifier<?> orderSpecifier)
Defines ORDER BY specifier
- Parameters:
orderSpecifier
- order specifier ( example: db_table.db_column.asc() )- Returns:
- SelectQuery
public SelectQuery rightJoin(com.querydsl.core.types.EntityPath<?> table)
Adds a right join to query
- Parameters:
table
- table to join- Returns:
- SelectQuery
public <E> SelectQuery rightJoin(com.querydsl.sql.ForeignKey<E> key, com.querydsl.sql.RelationalPath<E> table)
Adds a right join to query
- Parameters:
key
- foreign key to make jointable
- table to join- Returns:
- SelectQuery
public SelectQuery where(com.querydsl.core.types.Predicate... conditions)
Add conditions for selection results
- Returns:
- SelectQuery
public SelectQuery where(com.querydsl.core.types.Predicate condition)
Add condition for selection results
- Returns:
- SelectQuery
public com.querydsl.core.Tuple firstResult(com.querydsl.core.types.Expression<?>... columns)
Returns first result for the given SelectQuery or null if no result is found
This function caches its results, to speed up default behavior
Use firstResult(columns) to get non cached result every time
- Parameters:
columns
- to return as Tuple- Returns:
- Tuple containing column values for matching result
public com.querydsl.core.Tuple uniqueResult(com.querydsl.core.types.Expression<?>... columns)
Returns a unique result for the given SelectQuery
This function caches its results, to speed up default behavior
Use uniqueResult(columns) to get non cached result every time
- Parameters:
columns
- to return as Tuple- Returns:
- Tuple containing column values for matching result
- Throws:
RuntimeException
- if there is no matching results or more than one matching result
public com.querydsl.core.Tuple firstResult(boolean cached, com.querydsl.core.types.Expression<?>... columns)
Returns first result for the given SelectQuery or null if no result is found
This function caches its results, to speed up default behavior
Use firstResult(columns) to get non cached result every time
- Parameters:
cached
- if true, then this method will try to use cached values to avoid database accesscolumns
- to return as Tuple- Returns:
- Tuple containing column values for matching result
public com.querydsl.core.Tuple uniqueResult(boolean cached, com.querydsl.core.types.Expression<?>... columns)
Returns a unique result for the given SelectQuery
This function caches its results, to speed up default behavior
Use uniqueResult(columns) to get non cached result every time
- Parameters:
cached
- if true, then this method will try to use cached values to avoid database accesscolumns
- to return as Tuple- Returns:
- Tuple containing column values for matching result
- Throws:
RuntimeException
- if there is no matching results or more than one matching result
public <RT,T> RT firstResult(com.querydsl.core.types.Expression<T> column, Class<RT> returnType)
Returns first result for the given SelectQuery or null if no result is found
This function caches its results, to speed up default behavior
Use firstResult(false, column, returnType) to get non cached result every time
- Parameters:
column
- to returnreturnType
- type required to be returned by this function- Returns:
- the resulting value of column
public <RT> RT firstResult(com.querydsl.core.types.Expression<RT> column)
Returns first result for the given SelectQuery or null if no result is found
This function caches its results, to speed up default behavior
Use firstResult(false, column) to get non cached result every time
- Parameters:
column
- to return- Returns:
- the resulting value of column
public <RT,T> RT uniqueResult(com.querydsl.core.types.Expression<T> column, Class<RT> returnType)
Returns an unique result for the given SelectQuery
This function caches its results, to speed up default behavior
Use uniqueResult(false, column, returnType) to get non cached result every time
- Parameters:
column
- to returnreturnType
- type required to be returned by this function- Returns:
- the resulting value of column
- Throws:
RuntimeException
- if there is no matching results or more than one matching result
public <RT> RT uniqueResult(com.querydsl.core.types.Expression<RT> column)
Returns an unique result for the given SelectQuery
This function caches its results, to speed up default behavior
Use uniqueResult(false, column) to get non cached result every time
- Parameters:
column
- to return- Returns:
- the resulting value of column
- Throws:
RuntimeException
- if there is no matching results or more than one matching result
public <RT,T> RT firstResult(boolean cached, com.querydsl.core.types.Expression<T> column, Class<RT> returnType)
Returns first result for the given SelectQuery or null if no result is found
- Parameters:
cached
- if true, then this method will try to use cached values to avoid database accesscolumn
- to returnreturnType
- type required to be returned by this function- Returns:
- the resulting value of column
public <RT> RT firstResult(boolean cached, com.querydsl.core.types.Expression<RT> column)
Returns first result for the given SelectQuery or null if no result is found
- Parameters:
cached
- if true, then this method will try to use cached values to avoid database accesscolumn
- to return- Returns:
- the resulting value of column
public <RT,T> RT uniqueResult(boolean cached, com.querydsl.core.types.Expression<T> column, Class<RT> returnType)
Returns an unique result for the given SelectQuery
- Parameters:
cached
- if true, then this method will try to use cached values to avoid database accesscolumn
- to returnreturnType
- type required to be returned by this function- Returns:
- the resulting value of column
- Throws:
RuntimeException
- if there is no matching results or more than one matching result
public <RT> RT uniqueResult(boolean cached, com.querydsl.core.types.Expression<RT> column)
Returns an unique result for the given SelectQuery
- Parameters:
cached
- if true, then this method will try to use cached values to avoid database accesscolumn
- to return- Returns:
- the resulting value of column
- Throws:
RuntimeException
- if there is no matching results or more than one matching result
public TableFunction tableFunction(TableFunction tableFunction, com.querydsl.core.types.Expression<? extends Number> argumentColumn, com.querydsl.core.types.Expression<? extends Number> valueColumn)
Executes the given SELECT query which should return 2 columns of data:
the first column contains arguments numbers,
the second column contains values numbers.
- Parameters:
tableFunction
- the table function to fillargumentColumn
- column with argumentsvalueColumn
- column with values- Returns:
- the given table function, for convenience
public double[] arrayOfDouble(com.querydsl.core.types.Expression<? extends Number> valueColumn)
Executes the given SELECT query which should return 1 column with numbers.
Returns the array of numbers from the column.
An empty array is returned for no results
- Parameters:
valueColumn
- column with values- Returns:
- array of 'double' numbers
public int[] arrayOfInt(com.querydsl.core.types.Expression<? extends Number> valueColumn)
Executes the given SELECT query which should return 1 column with numbers.
Returns the array of numbers from the column.
An empty array is returned for no results
- Parameters:
valueColumn
- column with values- Returns:
- array of 'int' numbers