com.jpattern.orm.query.find
Class CustomFindOrderByImpl

java.lang.Object
  extended by com.jpattern.orm.query.SmartRenderableSqlSubElement
      extended by com.jpattern.orm.query.clause.OrmOrderBy<CustomFindOrderBy>
          extended by com.jpattern.orm.query.find.CustomFindOrderByImpl
All Implemented Interfaces:
BaseFindQuery, OrderBy<CustomFindOrderBy>, SqlClause<CustomFindOrderBy>, CustomQuery, CustomFindOrderBy, CustomFindQueryCommon, NameSolverConsumer, QueryRoot, RenderableSqlQuery, RenderableSqlSubElement

public class CustomFindOrderByImpl
extends OrmOrderBy<CustomFindOrderBy>
implements CustomFindOrderBy

Author:
ufo

Constructor Summary
CustomFindOrderByImpl(CustomFindQuery customFindQuery)
           
 
Method Summary
 void appendValues(List<Object> values)
          Append to the list all the values of the expression's elements
<T> T
find(ResultSetReader<T> rse)
          Execute the query reading the ResultSet with a ResultSetReader.
<T> List<T>
find(ResultSetRowReader<T> rsrr)
          Execute the query reading the ResultSet with a ResultSetRowReader.
 BigDecimal findBigDecimal()
          Execute the query and read the result as a BigDecimal value
 boolean findBoolean()
          Execute the query and read the result as a boolean value
 double findDouble()
          Execute the query and read the result as a double value
 float findFloat()
          Execute the query and read the result as a float value
 int findInt()
          Execute the query and read the result as an int value
 List<Object[]> findList()
          Execute the query and read the result creating a List of all the ordered arrays with the extracted column values for every row.
 long findLong()
          Execute the query and read the result as an long value
 String findString()
          Execute the query and read the result as a String value
 Object[] findUnique()
          Execute the query and read the result creating an ordered array with the extracted column values or null (if no matching bean is found).
<T> T
findUnique(ResultSetRowReader<T> rsrr)
          Execute the query reading the ResultSet with a ResultSetRowReader.
 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  CustomFindOrderBy orderBy()
           
 CustomFindQuery 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
 CustomFindQuery setDistinct(boolean distinct)
          Whether to use Distinct in the select clause
 CustomFindQuery setLockMode(LockMode lockMode)
           
 CustomFindQuery setMaxRows(int maxRows)
          Set the maximum number of rows to return in the query.
 CustomFindQuery setQueryTimeout(int queryTimeout)
          Set the query timeout for the query.
 CustomFindWhere 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

CustomFindOrderByImpl

public CustomFindOrderByImpl(CustomFindQuery customFindQuery)
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 CustomFindQuery query()
Specified by:
query in interface CustomFindOrderBy

where

public CustomFindWhere where()
                      throws OrmException
Description copied from interface: CustomFindOrderBy
Set the where clause.

Specified by:
where in interface CustomFindOrderBy
Returns:
Throws:
OrmException

find

public <T> T find(ResultSetReader<T> rse)
       throws OrmException
Description copied from interface: CustomQuery
Execute the query reading the ResultSet with a ResultSetReader.

Specified by:
find in interface CustomQuery
Returns:
an arbitrary result object, as returned by the ResultSetReader
Throws:
OrmException

orderBy

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

findList

public List<Object[]> findList()
                        throws OrmException
Description copied from interface: CustomQuery
Execute the query and read the result creating a List of all the ordered arrays with the extracted column values for every row.

Specified by:
findList in interface CustomQuery
Returns:
Throws:
OrmException

findUnique

public Object[] findUnique()
                    throws OrmNotUniqueResultException
Description copied from interface: CustomQuery
Execute the query and read the result creating an ordered array with the extracted column values or null (if no matching bean is found).

Specified by:
findUnique in interface CustomQuery
Returns:
Throws:
OrmNotUniqueResultException - if not exactly one row is returned from the query

findInt

public int findInt()
            throws OrmException
Description copied from interface: CustomQuery
Execute the query and read the result as an int value

Specified by:
findInt in interface CustomQuery
Returns:
Throws:
OrmException

findLong

public long findLong()
              throws OrmException
Description copied from interface: CustomQuery
Execute the query and read the result as an long value

Specified by:
findLong in interface CustomQuery
Returns:
Throws:
OrmException

findDouble

public double findDouble()
                  throws OrmException
Description copied from interface: CustomQuery
Execute the query and read the result as a double value

Specified by:
findDouble in interface CustomQuery
Returns:
Throws:
OrmException

findFloat

public float findFloat()
                throws OrmException
Description copied from interface: CustomQuery
Execute the query and read the result as a float value

Specified by:
findFloat in interface CustomQuery
Returns:
Throws:
OrmException

findString

public String findString()
                  throws OrmException
Description copied from interface: CustomQuery
Execute the query and read the result as a String value

Specified by:
findString in interface CustomQuery
Returns:
Throws:
OrmException

findBoolean

public boolean findBoolean()
                    throws OrmException
Description copied from interface: CustomQuery
Execute the query and read the result as a boolean value

Specified by:
findBoolean in interface CustomQuery
Returns:
Throws:
OrmException

findBigDecimal

public BigDecimal findBigDecimal()
                          throws OrmException
Description copied from interface: CustomQuery
Execute the query and read the result as a BigDecimal value

Specified by:
findBigDecimal in interface CustomQuery
Returns:
Throws:
OrmException

setLockMode

public CustomFindQuery setLockMode(LockMode lockMode)
Specified by:
setLockMode in interface CustomFindQueryCommon
Returns:

getLockMode

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

Specified by:
getLockMode in interface CustomFindQueryCommon
Returns:

getMaxRows

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

Specified by:
getMaxRows in interface CustomFindQueryCommon
Returns:
Throws:
OrmException

setMaxRows

public CustomFindQuery setMaxRows(int maxRows)
                           throws OrmException
Description copied from interface: CustomFindQueryCommon
Set the maximum number of rows to return in the query.

Specified by:
setMaxRows in interface CustomFindQueryCommon
Returns:
Throws:
OrmException

setQueryTimeout

public CustomFindQuery setQueryTimeout(int queryTimeout)
Description copied from interface: CustomFindQueryCommon
Set the query timeout for the query.

Specified by:
setQueryTimeout in interface CustomFindQueryCommon

getQueryTimeout

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

Specified by:
getQueryTimeout in interface CustomFindQueryCommon

setDistinct

public CustomFindQuery setDistinct(boolean distinct)
                            throws OrmException
Description copied from interface: CustomFindQueryCommon
Whether to use Distinct in the select clause

Specified by:
setDistinct in interface CustomFindQueryCommon
Returns:
Throws:
OrmException

isDistinct

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

Specified by:
isDistinct in interface CustomFindQueryCommon
Returns:
Throws:
OrmException

find

public <T> List<T> find(ResultSetRowReader<T> rsrr)
             throws OrmException
Description copied from interface: CustomQuery
Execute the query reading the ResultSet with a ResultSetRowReader.

Specified by:
find in interface CustomQuery
Parameters:
rsrr - object that will extract all rows of results
Returns:
a List of result objects returned by the ResultSetRowReader
Throws:
OrmException

findUnique

public <T> T findUnique(ResultSetRowReader<T> rsrr)
             throws OrmException,
                    OrmNotUniqueResultException
Description copied from interface: CustomQuery
Execute the query reading the ResultSet with a ResultSetRowReader.

Specified by:
findUnique in interface CustomQuery
Parameters:
rsrr - object that will extract the row of result
Returns:
Throws:
OrmException
OrmNotUniqueResultException - if the results of the query executions are not exactly 1


Copyright © 2013. All Rights Reserved.