public class QueryStatementFactory extends Object implements ConfigurableStatementFactory
Statement based on the type and parameters of a given query:
_CallableStatement for stored p rocedure queries _PreparedStatement for queries with input parameters _Standard Statement
otherwise| Constructor and Description |
|---|
QueryStatementFactory() |
| Modifier and Type | Method and Description |
|---|---|
Statement |
create(DbConnection connection,
QueryTemplate queryTemplate)
Creates a JDBC statement
|
Statement |
create(DbConnection connection,
QueryTemplate queryTemplate,
AutoGenerateKeysStrategy autoGenerateKeysStrategy)
Creates a JDBC statement with auto generated keys processing
|
void |
setFetchSize(int size)
Indicates how many rows should fetched from the database any time more rows are requested on any resultSet returned by a
statement created by this factory
|
void |
setMaxRows(int max)
Sets the maximum numbers of rows that will be returned by any resultSet returned by a statement created by this factory
|
void |
setQueryTimeout(int queryTimeout)
Indicates the minimum amount of time in seconds before the JDBC driver attempts to cancel a running statement.
|
public Statement create(DbConnection connection, QueryTemplate queryTemplate) throws SQLException
StatementFactorycreate in interface StatementFactoryconnection - connection uses to create the statementqueryTemplate - query template that will be execute on the statementSQLException - if a database access error occurs or this method is called on a closed connectionpublic Statement create(DbConnection connection, QueryTemplate queryTemplate, AutoGenerateKeysStrategy autoGenerateKeysStrategy) throws SQLException
StatementFactorycreate in interface StatementFactoryconnection - connection uses to create the statementqueryTemplate - query template that will be execute on the statementautoGenerateKeysStrategy - strategy to process auto generated keysSQLException - if a database access error occurs or this method is called on a closed connectionpublic void setMaxRows(int max)
ConfigurableStatementFactorysetMaxRows in interface ConfigurableStatementFactorymax - the new max rows limit; zero means there is no limitpublic void setFetchSize(int size)
ConfigurableStatementFactorysetFetchSize in interface ConfigurableStatementFactorysize - the number of rows to fetchpublic void setQueryTimeout(int queryTimeout)
ConfigurableStatementFactorysetQueryTimeout in interface ConfigurableStatementFactoryqueryTimeout - number of seconds to wait. Non negative. Zero means no timeout.Copyright © 2024. All rights reserved.