com.googlecode.jpattern.orm.query
Class OrmCustomQuery

java.lang.Object
  extended by com.googlecode.jpattern.orm.query.AQuery
      extended by com.googlecode.jpattern.orm.query.ABaseOrmQuery
          extended by com.googlecode.jpattern.orm.query.OrmCustomQuery
All Implemented Interfaces:
IBaseOrmQuery, ICustomQuery, INameSolverConsumer, IOrmCustomQuery, IQuery, IRenderableSqlObject

public class OrmCustomQuery
extends ABaseOrmQuery
implements IOrmCustomQuery, INameSolverConsumer

Author:
Francesco Cina 20/giu/2011

Constructor Summary
OrmCustomQuery(String selectClause, IOrmClassToolMap ormClassToolMap, ISessionSqlPerformer session, Class<?> clazz, Class<?>... joinClasses)
           
 
Method Summary
<T> T
find(IResultSetReader<T> rse)
          Execute the query reading the ResultSet with a IResultSetReader.
 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 wuery 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).
 int getMaxRows()
          Return the max rows for this query.
 int getQueryTimeout()
          Return the query timeout for the query.
protected  void renderFrom(StringBuilder StringBuilder)
           
protected  void renderOrderBy(StringBuilder StringBuilder)
           
protected  void renderSelect(StringBuilder StringBuilder)
           
protected  void renderWhere(StringBuilder StringBuilder)
           
 IOrmCustomQuery setMaxRows(int maxRows)
          Set the maximum number of rows to return in the query.
 void setNameSolver(INameSolver nameSolver)
           
 IOrmCustomQuery setQueryTimeout(int queryTimeout)
          Set the query timeout for the query.
 
Methods inherited from class com.googlecode.jpattern.orm.query.ABaseOrmQuery
appendValues, join, orderBy, renderSql, renderSql, setJoin, setOrderBy, setWhere, where
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.googlecode.jpattern.orm.query.IBaseOrmQuery
join, orderBy, where
 
Methods inherited from interface com.googlecode.jpattern.orm.query.IQuery
appendValues
 
Methods inherited from interface com.googlecode.jpattern.orm.query.IRenderableSqlObject
renderSql, renderSql
 

Constructor Detail

OrmCustomQuery

public OrmCustomQuery(String selectClause,
                      IOrmClassToolMap ormClassToolMap,
                      ISessionSqlPerformer session,
                      Class<?> clazz,
                      Class<?>... joinClasses)
Method Detail

setNameSolver

public void setNameSolver(INameSolver nameSolver)
Specified by:
setNameSolver in interface INameSolverConsumer

findList

public List<Object[]> findList()
Description copied from interface: ICustomQuery
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 ICustomQuery
Returns:

findUnique

public Object[] findUnique()
                    throws OrmNotUniqueResultException
Description copied from interface: ICustomQuery
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 ICustomQuery
Returns:
Throws:
OrmNotUniqueResultException - if more than one row is returned from the query

renderSelect

protected void renderSelect(StringBuilder StringBuilder)
Specified by:
renderSelect in class ABaseOrmQuery

renderFrom

protected void renderFrom(StringBuilder StringBuilder)
Specified by:
renderFrom in class ABaseOrmQuery

renderWhere

protected void renderWhere(StringBuilder StringBuilder)
Specified by:
renderWhere in class ABaseOrmQuery

renderOrderBy

protected void renderOrderBy(StringBuilder StringBuilder)
Specified by:
renderOrderBy in class ABaseOrmQuery

find

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

Specified by:
find in interface ICustomQuery
Parameters:
rse - object that will extract all rows of results
Returns:
an arbitrary result object, as returned by the IResultSetExtractor
Throws:
OrmException

findInt

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

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

findLong

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

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

findDouble

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

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

findFloat

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

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

findString

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

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

findBoolean

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

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

findBigDecimal

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

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

getMaxRows

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

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

setQueryTimeout

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

Specified by:
setQueryTimeout in interface IOrmCustomQuery
Specified by:
setQueryTimeout in interface IQuery

getQueryTimeout

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

Specified by:
getQueryTimeout in interface IQuery

setMaxRows

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

Specified by:
setMaxRows in interface IOrmCustomQuery
Specified by:
setMaxRows in interface IQuery
Returns:
Throws:
OrmException


Copyright © 2011. All Rights Reserved.