com.jpattern.orm.query.sql
Class PlainSqlFindQuery

java.lang.Object
  extended by com.jpattern.orm.query.sql.PlainSqlFindQuery
All Implemented Interfaces:
BaseFindQuery, CustomQuery, QueryRoot, RenderableSqlQuery, SqlFindQuery

public class PlainSqlFindQuery
extends Object
implements SqlFindQuery

Author:
Francesco Cina 09/lug/2011

Constructor Summary
PlainSqlFindQuery(SessionSqlPerformer session, String sql, Object[] args)
           
 
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.
 int getMaxRows()
          Return the max rows for this query.
 int getQueryTimeout()
          Return the query timeout for the 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
 SqlFindQuery setMaxRows(int maxRows)
          Set the maximum number of rows to return in the query.
 SqlFindQuery setQueryTimeout(int queryTimeout)
          Set the query timeout for the query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlainSqlFindQuery

public PlainSqlFindQuery(SessionSqlPerformer session,
                         String sql,
                         Object[] args)
Method Detail

getMaxRows

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

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

setQueryTimeout

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

Specified by:
setQueryTimeout in interface SqlFindQuery

getQueryTimeout

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

Specified by:
getQueryTimeout in interface SqlFindQuery

setMaxRows

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

Specified by:
setMaxRows in interface SqlFindQuery
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

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
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

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

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


Copyright © 2013. All Rights Reserved.