|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ujoframework.orm.Query<UJO>
public class Query<UJO extends OrmUjo>
ORM query.
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | ||
|---|---|---|
void |
addCriterion(Criterion<UJO> criterion)
Add a new Criterion |
|
Query<UJO> |
addOrderBy(UjoProperty<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(). |
|
MetaColumn |
getColumn(int index)
Get Column List |
|
java.util.List<MetaColumn> |
getColumns()
Get Column List |
|
long |
getCount()
Returns a count of the items |
|
Criterion<UJO> |
getCriterion()
Criterion |
|
CriterionDecoder |
getDecoder()
Method builds and retuns a criterion decoder. |
|
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. |
|
int |
getOffset()
Get the first row to retrieve (offset). |
|
java.util.List<UjoProperty<UJO,?>> |
getOrderBy()
Get the order item list. |
|
Session |
getSession()
Session |
|
java.sql.PreparedStatement |
getStatement()
Create a PreparedStatement include assigned parameter values |
|
java.lang.String |
getStatementInfo()
Get the SQL statement or null, of statement is not known yet. |
|
MetaTable |
getTableModel()
Table Type |
|
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. |
|
java.util.List<UJO> |
list()
There is recommended to use the method iterator() rather. |
|
Query<UJO> |
orderBy(java.util.List<UjoProperty> orderItems)
Set an order of the rows by a SQL ORDER BY phrase. |
|
Query<UJO> |
orderBy(UjoProperty<UJO,?> orderItem)
Set an order of the rows by a SQL ORDER BY phrase. |
|
Query<UJO> |
orderBy(UjoProperty<UJO,?> orderItem1,
UjoProperty<UJO,?> orderItem2)
Set an order of the rows by a SQL ORDER BY phrase. |
|
Query<UJO> |
orderBy(UjoProperty<UJO,?> orderItem1,
UjoProperty<UJO,?> orderItem2,
UjoProperty<UJO,?> orderItem3)
Set an order of the rows by a SQL ORDER BY phrase. |
|
Query<UJO> |
orderByMany(UjoProperty... orderItems)
Set an order of the rows by a SQL ORDER BY phrase. |
|
MetaColumn |
readOrderColumn(int i)
Returns an order column. |
|
Query<UJO> |
setCriterion(Criterion<UJO> criterion)
Set a new Criterion |
|
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,
int 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(UjoProperty... order)
Deprecated. Use the orderByMany(org.ujoframework.UjoProperty[]) method instead of |
|
|
setParameter(UjoProperty<UJO,ITEM> property,
ITEM value)
|
|
Query<UJO> |
setSession(Session session)
An open session must be assigned before executing a database request. |
|
java.lang.String |
toString()
|
|
UJO |
uniqueResult()
Returns a unique result or null if no result item (database row) was found. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Query(MetaTable table,
Criterion<UJO> criterion,
Session session)
table - Table modelcriterion - If criterion is null, then a TRUE constant criterion is used.session - Session
public 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.ujoframework.orm.Session)| Method Detail |
|---|
public Query<UJO> setSession(Session session)
public long getLimitedCount()
getCount()public long getCount()
getLimitedCount()
public <ITEM> void setParameter(UjoProperty<UJO,ITEM> property,
ITEM value)
public void addCriterion(Criterion<UJO> criterion)
public Query<UJO> setCriterion(Criterion<UJO> criterion)
public Criterion<UJO> getCriterion()
public final CriterionDecoder getDecoder()
public Session getSession()
public MetaTable getTableModel()
public java.util.List<MetaColumn> getColumns()
public MetaColumn getColumn(int index)
public UjoIterator<UJO> iterator()
for(...) directly.
iterator().toList()
iterator in interface java.lang.Iterable<UJO extends OrmUjo>uniqueResult(),
exists()@Deprecated public final UjoIterator<UJO> iterate()
iterator() instead of.
iterator()public java.util.List<UJO> list()
iterator() rather.
The method calls internally the next statement:
iterator().toList()
iterator(),
OrmTools.loadLazyValues(java.lang.Iterable, int),
OrmTools.loadLazyValuesAsBatch(org.ujoframework.orm.Query)
public UJO uniqueResult()
throws java.util.NoSuchElementException
java.util.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 java.util.List<UjoProperty<UJO,?>> getOrderBy()
@Deprecated public Query<UJO> setOrder(UjoProperty... order)
orderByMany(org.ujoframework.UjoProperty[]) method instead of
orderByMany(org.ujoframework.UjoProperty[])public Query<UJO> orderBy(UjoProperty<UJO,?> orderItem)
public Query<UJO> orderBy(UjoProperty<UJO,?> orderItem1,
UjoProperty<UJO,?> orderItem2)
public Query<UJO> orderBy(UjoProperty<UJO,?> orderItem1,
UjoProperty<UJO,?> orderItem2,
UjoProperty<UJO,?> orderItem3)
public Query<UJO> orderByMany(UjoProperty... orderItems)
public Query<UJO> orderBy(java.util.List<UjoProperty> orderItems)
addOrderBy(org.ujoframework.UjoProperty) rather.
addOrderBy(org.ujoframework.UjoProperty)public Query<UJO> addOrderBy(UjoProperty<UJO,?> property)
public MetaColumn readOrderColumn(int i)
public boolean isOffset()
public final int getOffset()
public Query<UJO> setOffset(int offset)
setLimit(int, int)public final int getLimit()
java.sql.Statement#getLimit()public Query<UJO> setLimit(int limit)
Statement.setMaxRows(int)
public Query<UJO> setLimit(int limit,
int 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 java.sql.PreparedStatement getStatement()
public java.lang.String getStatementInfo()
public boolean isLockRequest()
public Query<UJO> setLockRequest(boolean lockRequest)
public Query<UJO> setLockRequest()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||