com.jpattern.orm.query.find
Class FindOrderByImpl<BEAN>

java.lang.Object
  extended by com.jpattern.orm.query.SmartRenderableSqlSubElement
      extended by com.jpattern.orm.query.clause.OrmOrderBy<FindOrderBy<BEAN>>
          extended by com.jpattern.orm.query.find.FindOrderByImpl<BEAN>
Type Parameters:
BEAN -
All Implemented Interfaces:
BaseFindQuery, OrderBy<FindOrderBy<BEAN>>, SqlClause<FindOrderBy<BEAN>>, FindOrderBy<BEAN>, FindQueryCommon<BEAN>, NameSolverConsumer, QueryRoot, RenderableSqlQuery, RenderableSqlSubElement

public class FindOrderByImpl<BEAN>
extends OrmOrderBy<FindOrderBy<BEAN>>
implements FindOrderBy<BEAN>

Author:
ufo

Constructor Summary
FindOrderByImpl(FindQuery<BEAN> findQuery)
           
 
Method Summary
 void appendValues(List<Object> values)
          Append to the list all the values of the expression's elements
 BEAN find()
          Execute the query returning either a single bean, if the ResultSet contains at least one row, or null, if no matching beans are found).
 void find(OrmRowMapper<BEAN> srr)
          Execute the query and for every object created call the IOrmSerialResultReader.
 List<BEAN> findList()
          Execute the query returning the list of objects.
 int findRowCount()
          Return the count of entities this query should return.
 BEAN findUnique()
          Execute the query returning either a single bean or an Exception.
 String getGeneratedRowCountSql()
          Return the sql that was generated to return the row count of the execution of this query.
 LockMode getLockMode()
          Return the current lock mode
 int getMaxRows()
          Return the max rows for this query.
 int getQueryTimeout()
          Return the query timeout for the query.
 boolean isDistinct()
          return if use Distinct in the select clause
protected  FindOrderBy<BEAN> orderBy()
           
 FindQuery<BEAN> query()
           
 String renderSql()
          Return the sql query generated by this IQuery Object
 void renderSql(StringBuilder stringBuilder)
          Append to the string buffer the sql query generated by this IQuery Object
 FindQuery<BEAN> setDistinct(boolean distinct)
          Whether to use Distinct in the select clause
 FindQuery<BEAN> setLockMode(LockMode lockMode)
           
 FindQuery<BEAN> setMaxRows(int maxRows)
          Set the maximum number of rows to return in the query.
 FindQuery<BEAN> setQueryTimeout(int queryTimeout)
          Set the query timeout for the query.
 FindWhere<BEAN> where()
          Set the where clause.
 
Methods inherited from class com.jpattern.orm.query.clause.OrmOrderBy
appendElementValues, asc, ascNullsFirst, ascNullsLast, desc, descNullsFirst, descNullsLast, doElementRender, getElementStatusVersion, setNameSolver
 
Methods inherited from class com.jpattern.orm.query.SmartRenderableSqlSubElement
isElementStatusChanged, renderSqlElement, renderSqlElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jpattern.orm.query.clause.OrderBy
asc, ascNullsFirst, ascNullsLast, desc, descNullsFirst, descNullsLast
 

Constructor Detail

FindOrderByImpl

public FindOrderByImpl(FindQuery<BEAN> findQuery)
Method Detail

renderSql

public String renderSql()
Description copied from interface: RenderableSqlQuery
Return the sql query generated by this IQuery Object

Specified by:
renderSql in interface RenderableSqlQuery
Returns:

renderSql

public void renderSql(StringBuilder stringBuilder)
Description copied from interface: RenderableSqlQuery
Append to the string buffer the sql query generated by this IQuery Object

Specified by:
renderSql in interface RenderableSqlQuery

appendValues

public void appendValues(List<Object> values)
Description copied from interface: RenderableSqlQuery
Append to the list all the values of the expression's elements

Specified by:
appendValues in interface RenderableSqlQuery

query

public FindQuery<BEAN> query()
Specified by:
query in interface FindOrderBy<BEAN>

where

public FindWhere<BEAN> where()
                      throws OrmException
Description copied from interface: FindOrderBy
Set the where clause.

Specified by:
where in interface FindOrderBy<BEAN>
Returns:
Throws:
OrmException

orderBy

protected FindOrderBy<BEAN> orderBy()
                             throws OrmException
Specified by:
orderBy in class OrmOrderBy<FindOrderBy<BEAN>>
Throws:
OrmException

findList

public List<BEAN> findList()
                    throws OrmException
Description copied from interface: FindQueryCommon
Execute the query returning the list of objects.

Specified by:
findList in interface FindQueryCommon<BEAN>
Returns:
Throws:
OrmException

findRowCount

public int findRowCount()
                 throws OrmException
Description copied from interface: FindQueryCommon
Return the count of entities this query should return.

Specified by:
findRowCount in interface FindQueryCommon<BEAN>
Returns:
Throws:
OrmException

findUnique

public BEAN findUnique()
                throws OrmException,
                       OrmNotUniqueResultException
Description copied from interface: FindQueryCommon
Execute the query returning either a single bean or an Exception.

Specified by:
findUnique in interface FindQueryCommon<BEAN>
Returns:
Throws:
OrmNotUniqueResultException - if zero or more than one row are returned from the query
OrmException

find

public void find(OrmRowMapper<BEAN> srr)
          throws OrmException
Description copied from interface: FindQueryCommon
Execute the query and for every object created call the IOrmSerialResultReader. The objects are created one after the other to avoid the use of too much memory.

Specified by:
find in interface FindQueryCommon<BEAN>
Throws:
OrmException

getGeneratedRowCountSql

public String getGeneratedRowCountSql()
                               throws OrmException
Description copied from interface: FindQueryCommon
Return the sql that was generated to return the row count of the execution of this query.

Specified by:
getGeneratedRowCountSql in interface FindQueryCommon<BEAN>
Returns:
Throws:
OrmException

setDistinct

public FindQuery<BEAN> setDistinct(boolean distinct)
                            throws OrmException
Description copied from interface: FindQueryCommon
Whether to use Distinct in the select clause

Specified by:
setDistinct in interface FindQueryCommon<BEAN>
Returns:
Throws:
OrmException

isDistinct

public boolean isDistinct()
                   throws OrmException
Description copied from interface: FindQueryCommon
return if use Distinct in the select clause

Specified by:
isDistinct in interface FindQueryCommon<BEAN>
Returns:
Throws:
OrmException

setLockMode

public FindQuery<BEAN> setLockMode(LockMode lockMode)
Specified by:
setLockMode in interface FindQueryCommon<BEAN>
Returns:

getLockMode

public LockMode getLockMode()
Description copied from interface: FindQueryCommon
Return the current lock mode

Specified by:
getLockMode in interface FindQueryCommon<BEAN>
Returns:

getMaxRows

public int getMaxRows()
               throws OrmException
Description copied from interface: FindQueryCommon
Return the max rows for this query.

Specified by:
getMaxRows in interface FindQueryCommon<BEAN>
Returns:
Throws:
OrmException

setMaxRows

public FindQuery<BEAN> setMaxRows(int maxRows)
                           throws OrmException
Description copied from interface: FindQueryCommon
Set the maximum number of rows to return in the query.

Specified by:
setMaxRows in interface FindQueryCommon<BEAN>
Returns:
Throws:
OrmException

setQueryTimeout

public FindQuery<BEAN> setQueryTimeout(int queryTimeout)
Description copied from interface: FindQueryCommon
Set the query timeout for the query.

Specified by:
setQueryTimeout in interface FindQueryCommon<BEAN>

getQueryTimeout

public int getQueryTimeout()
Description copied from interface: FindQueryCommon
Return the query timeout for the query.

Specified by:
getQueryTimeout in interface FindQueryCommon<BEAN>

find

public BEAN find()
          throws OrmException,
                 OrmNotUniqueResultException
Description copied from interface: FindQueryCommon
Execute the query returning either a single bean, if the ResultSet contains at least one row, or null, if no matching beans are found).

Specified by:
find in interface FindQueryCommon<BEAN>
Returns:
Throws:
OrmNotUniqueResultException - if zero or more than one row are returned from the query
OrmException


Copyright © 2013. All Rights Reserved.