java.lang.Object
org.seasar.doma.jdbc.query.AbstractQuery
org.seasar.doma.jdbc.query.AbstractSelectQuery
org.seasar.doma.jdbc.query.CountQuery
- All Implemented Interfaces:
Query,SelectQuery
A query that counts the number of rows that would be returned by a SELECT statement.
This class extends AbstractSelectQuery to provide functionality for transforming a
SELECT query into a COUNT query. It uses the database dialect to transform the SQL node for
counting.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SqlNodeThe SQL node representing the original SELECT query.Fields inherited from class org.seasar.doma.jdbc.query.AbstractSelectQuery
aggregateStrategyType, entityType, fetchSize, fetchType, maxRows, options, parameters, resultEnsured, resultMappingEnsured, resultStream, sql, sqlLogTypeFields inherited from class org.seasar.doma.jdbc.query.AbstractQuery
callerClassName, callerMethodName, config, message, method, queryTimeout -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Completes this query after execution.Returns the fetch type for this query.booleanReturns whether the query is expected to return at least one result.booleanReturns whether the result mapping is ensured.voidprepare()Prepares this query for execution.protected voidPrepares the SQL for this query.voidsetSqlNode(SqlNode sqlNode) Sets the SQL node representing the original SELECT query.Methods inherited from class org.seasar.doma.jdbc.query.AbstractSelectQuery
addParameter, addParameters, buildSql, clearParameters, createExpressionEvaluator, executeCount, expandAggregateColumns, expandColumns, getFetchSize, getMaxRows, getOptions, getSql, getSqlLogType, isResultStream, populateValues, prepareOptions, setAggregateStrategyType, setEntityType, setFetchSize, setFetchType, setMaxRows, setOptions, setResultEnsured, setResultMappingEnsured, setResultStream, setSqlLogType, toStringMethods inherited from class org.seasar.doma.jdbc.query.AbstractQuery
comment, getClassName, getConfig, getMethod, getMethodName, getQueryTimeout, setCallerClassName, setCallerMethodName, setConfig, setMessage, setMethod, setQueryTimeoutMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.seasar.doma.jdbc.query.Query
comment, getClassName, getConfig, getMethod, getMethodName, getQueryTimeout
-
Field Details
-
sqlNode
The SQL node representing the original SELECT query.
-
-
Constructor Details
-
CountQuery
public CountQuery()
-
-
Method Details
-
isResultEnsured
public boolean isResultEnsured()Returns whether the query is expected to return at least one result.- Specified by:
isResultEnsuredin interfaceSelectQuery- Overrides:
isResultEnsuredin classAbstractSelectQuery- Returns:
trueif the query is expected to return at least one result
-
isResultMappingEnsured
public boolean isResultMappingEnsured()Returns whether the result mapping is ensured.- Specified by:
isResultMappingEnsuredin interfaceSelectQuery- Overrides:
isResultMappingEnsuredin classAbstractSelectQuery- Returns:
trueif the result mapping is ensured
-
getFetchType
Returns the fetch type for this query.- Specified by:
getFetchTypein interfaceSelectQuery- Overrides:
getFetchTypein classAbstractSelectQuery- Returns:
- the fetch type
-
prepare
public void prepare()Prepares this query for execution. This method must be called before the query is executed.This implementation prepares options and SQL.
- Specified by:
preparein interfaceQuery- Overrides:
preparein classAbstractSelectQuery
-
prepareSql
protected void prepareSql()Prepares the SQL for this query.This method must be implemented by subclasses to build the SQL statement.
- Specified by:
prepareSqlin classAbstractSelectQuery
-
complete
public void complete()Completes this query after execution. This method must be called after the query is executed. -
setSqlNode
Sets the SQL node representing the original SELECT query.- Parameters:
sqlNode- the SQL node
-