| Constructor and Description |
|---|
Query(MetaTable table,
Criterion<UJO> criterion)
Create new ORM query without a session.
|
Query(MetaTable table,
Criterion<UJO> criterion,
Session session)
Create new ORM query.
|
| Modifier and Type | Method and Description |
|---|---|
Query<UJO> |
addColumn(Key<UJO,?> column)
Set the one column to reading from database table.
|
void |
addCriterion(Criterion<UJO> criterion)
Add a new Criterion.
|
protected void |
addMissingColumn(ColumnWrapper column,
boolean addChilds,
boolean checkDuplicities)
Add a missing column.
|
Query<UJO> |
addOrderBy(Key<UJO,?> property)
Add an item to the end of order list.
|
boolean |
exists()
The method performs a new database request and returns result of the function
UjoIterator.hasNext(). |
ColumnWrapper[] |
getColumnArray()
Create a new column List.
|
List<ColumnWrapper> |
getColumns()
Get Column Collection
|
long |
getCount()
Returns a count of the items
|
Criterion<UJO> |
getCriterion()
Criterion
|
CriterionDecoder |
getDecoder()
Method builds and retuns a criterion decoder.
|
protected List<ColumnWrapper> |
getDefaultColumns()
Returns all direct columns of the base table.
|
int |
getFetchSize()
Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed.
|
int |
getLimit()
The max row count for the resultset.
|
long |
getLimitedCount()
Returns a database row count along a current limit and offset attribues.
|
long |
getOffset()
Get the first row to retrieve (offset).
|
Key<UJO,?>[] |
getOrderAsArray()
Get the order item array.
|
List<Key<UJO,?>> |
getOrderBy()
Get the order item list.
|
Session |
getSession()
Session
|
SqlParameters |
getSqlParameters()
Get a SQL parameters of the Native view
|
PreparedStatement |
getStatement()
Create a PreparedStatement including assigned parameter values
|
String |
getStatementInfo()
Get the SQL statement or null, of statement is not known yet.
|
MetaTable |
getTableModel()
Table Type
|
boolean |
isDistinct()
Select DISTINCT for a unique row result
|
boolean |
isLimit()
The max row count for the resultset.
|
boolean |
isLockRequest()
Pessimistic lock request
|
boolean |
isOffset()
Has this Query an offset?
|
UjoIterator<UJO> |
iterate()
Deprecated.
Use
iterator() instead of. |
UjoIterator<UJO> |
iterator()
Create a new iterator by the query.
|
List<UJO> |
list()
There is recommended to use the method
iterator() rather. |
List<UJO> |
list(int depth)
Create list and Load all lazy values for the current parameter
recursively until optional depth.
|
Query<UJO> |
orderBy(Collection<Key> orderItems)
Set an order of the rows by a SQL ORDER BY phrase.
|
Query<UJO> |
orderBy(Key<UJO,?> orderItem)
Set an order of the rows by a SQL ORDER BY phrase.
|
Query<UJO> |
orderBy(Key<UJO,?> orderItem1,
Key<UJO,?> orderItem2)
Set an order of the rows by a SQL ORDER BY phrase.
|
Query<UJO> |
orderBy(Key<UJO,?> orderItem1,
Key<UJO,?> orderItem2,
Key<UJO,?> orderItem3)
Set an order of the rows by a SQL ORDER BY phrase.
|
Query<UJO> |
orderByMany(Key... orderItems)
Set an order of the rows by a SQL ORDER BY phrase.
|
MetaColumn |
readOrderColumn(int i)
Returns an order column.
|
Query<UJO> |
setColumn(Key<UJO,?> column)
Set the one column to reading from database table.
|
Query<UJO> |
setColumns(boolean addPrimaryKey,
boolean addChilds,
Key... columns)
Set an list of required columns to reading from database table.
|
Query<UJO> |
setColumns(boolean addPrimaryKey,
Key... columns)
Set an list of required columns to reading from database table.
|
Query<UJO> |
setCriterion(Criterion<UJO> criterion)
Set a new Criterion.
|
Query<UJO> |
setDistinct()
Select DISTINCT for a unique row result
|
Query<UJO> |
setDistinct(boolean distinct)
Select DISTINCT for a unique row result
|
Query<UJO> |
setFetchSize(int fetchSize)
Retrieves the number of result set rows that is the default fetch size for ResultSet objects generated from this Statement object.
|
Query<UJO> |
setLimit(int limit)
The max row count for the resultset.
|
Query<UJO> |
setLimit(int limit,
long offset)
Set a limit and offset.
|
Query<UJO> |
setLockRequest()
Set pessimistic lock request.
|
Query<UJO> |
setLockRequest(boolean lockRequest)
Pessimistic lock request.
|
Query<UJO> |
setMaxRows(int limit)
Deprecated.
|
Query<UJO> |
setOffset(int offset)
Get the first row to retrieve (offset).
|
Query<UJO> |
setOrder(Key... order)
Deprecated.
Use the
orderByMany(org.ujorm.Key[]) method instead of |
<ITEM> void |
setParameter(Key<UJO,ITEM> property,
ITEM value) |
Query<UJO> |
setSession(Session session)
An open session must be assigned before executing a database request.
|
Query<UJO> |
setSqlParameters(Object... parameters)
Set a SQL parameters of the Native View
|
Query<UJO> |
setSqlParameters(SqlParameters sqlParameters)
Set a SQL parameters of the Native View
|
String |
toString() |
UJO |
uniqueResult()
Returns a unique result or null if no result item (database row) was found.
|
public Query(MetaTable table, Criterion<UJO> criterion, Session session)
table - Table model is mandatorycriterion - If criterion is null, then the ForAll criterion is used.session - Sessionpublic Query(MetaTable table, Criterion<UJO> criterion)
assigned before executing a database request.table - Table modelcriterion - If criterion is null, then a TRUE constant criterion is used.setSession(org.ujorm.orm.Session)public Query<UJO> setSession(Session session)
public long getLimitedCount()
getCount()public long getCount()
getLimitedCount()public void addCriterion(Criterion<UJO> criterion) throws IllegalArgumentException
criterion - Parameter is mandatory and must not be NULL.IllegalArgumentExceptioncreateQuery(Criterion),
setCriterion(..)public Query<UJO> setCriterion(Criterion<UJO> criterion)
criterion - The value NULL is allowed because the value is replaced internally to expression Criterion.where(true).
A MetaTable parameter must be specified in the constuctor for this case.createQuery(Criteron),
addCriterion(..)public final CriterionDecoder getDecoder()
public Session getSession()
public MetaTable getTableModel()
public List<ColumnWrapper> getColumns()
protected List<ColumnWrapper> getDefaultColumns()
public ColumnWrapper[] getColumnArray()
public UjoIterator<UJO> iterator()
for(...) directly.
iterator().toList()
@Deprecated public final UjoIterator<UJO> iterate()
iterator() instead of.iterator()public List<UJO> list()
iterator() rather.
The method calls internally the next statement:
iterator().toList()
public List<UJO> list(int depth)
depth - The object resursion depth where value 0 means: do not any lazy loading.
level. The current release supports only values: 0 and 1.iterator(),
OrmTools.loadLazyValues(java.lang.Iterable, int),
OrmTools.loadLazyValuesAsBatch(org.ujorm.orm.Query)public UJO uniqueResult() throws NoSuchElementException
NoSuchElementException - Result is not unique.iterator(),
exists()public boolean exists()
UjoIterator.hasNext().
The result TRUE means the query covers one item (database row) at least.iterator(),
uniqueResult()public final List<Key<UJO,?>> getOrderBy()
public final Key<UJO,?>[] getOrderAsArray()
@Deprecated public Query<UJO> setOrder(Key... order)
orderByMany(org.ujorm.Key[]) method instead oforderByMany(org.ujorm.Key[])public Query<UJO> orderBy(Key<UJO,?> orderItem)
public Query<UJO> orderBy(Key<UJO,?> orderItem1, Key<UJO,?> orderItem2)
public Query<UJO> orderBy(Key<UJO,?> orderItem1, Key<UJO,?> orderItem2, Key<UJO,?> orderItem3)
public final Query<UJO> orderByMany(Key... orderItems)
public Query<UJO> addColumn(Key<UJO,?> column) throws IllegalArgumentException
column - A Property to select. A composite Property is allowed however only the first item will be used.IllegalArgumentExceptionsetColumn(Property)public Query<UJO> setColumn(Key<UJO,?> column) throws IllegalArgumentException
column - A Property to select. A composite Property is allowed however only the first item will be used.IllegalArgumentExceptionaddColumn(Property)public final Query<UJO> setColumns(boolean addPrimaryKey, Key... columns) throws IllegalArgumentException
addPrimaryKey - If the column list does not contains a primary key then the one can be included.columns - A Key list including a compositer one to database select. The method does not check collumn duplicities.IllegalArgumentExceptionsetColumn(Property),
addColumn(Property)public final Query<UJO> setColumns(boolean addPrimaryKey, boolean addChilds, Key... columns) throws IllegalArgumentException
addPrimaryKey - If the column list doesn't contain a primary key of the base Entity then the one will be included.addChilds - Add all childs of the all foreign keys.columns - A Key list including a compositer one to database select. The method does not check collumn duplicities.IllegalArgumentExceptionsetColumn(Property),
addColumn(Property)protected void addMissingColumn(ColumnWrapper column, boolean addChilds, boolean checkDuplicities)
column - Add the column for case it is missing in the column listaddChilds - Add all childs of the foreign key.checkDuplicities - Check a duplicity columnpublic Query<UJO> orderBy(Collection<Key> orderItems)
addOrderBy(org.ujorm.Key) rather.addOrderBy(org.ujorm.Key)public MetaColumn readOrderColumn(int i) throws IllegalStateException
IllegalStateExceptionpublic boolean isOffset()
public final long getOffset()
public Query<UJO> setOffset(int offset)
#setLimit(int, int)public final boolean isLimit()
getLimit()public final int getLimit()
isLimit()public Query<UJO> setLimit(int limit)
Statement.setMaxRows(int)public Query<UJO> setLimit(int limit, long offset)
limit - The max row count for the resultset. The value -1 means no change, value 0 means no limit (or a default value by the JDBC driver implementation.offset - Get the first row to retrieve (offset). Default value is 0.setLimit(int),
setOffset(int)@Deprecated public final Query<UJO> setMaxRows(int limit)
setLimit(int) rather.setLimit(int)public int getFetchSize()
Statement.getFetchSize()public Query<UJO> setFetchSize(int fetchSize)
Statement.setFetchSize(int)public PreparedStatement getStatement()
public String getStatementInfo()
public boolean isLockRequest()
public Query<UJO> setLockRequest(boolean lockRequest)
HsqldbDialectpublic Query<UJO> setLockRequest()
HsqldbDialectpublic boolean isDistinct()
public SqlParameters getSqlParameters()
public Query<UJO> setSqlParameters(SqlParameters sqlParameters) throws IllegalArgumentException
IllegalArgumentException - The SQL parameters can be used for the VIEW onlyViewpublic Query<UJO> setSqlParameters(Object... parameters) throws IllegalArgumentException
IllegalArgumentException - The SQL parameters can be used for the VIEW onlyViewCopyright 2013, Pavel Ponec