PreparedStatementCreator
objects with different parameters based on an SQL statement and a single
set of parameter declarations.
| Modifier and Type | Class and Description |
|---|---|
| private class | PreparedStatementCreatorFactory.
PreparedStatementCreator implementation returned by this class. |
| Modifier and Type | Field and Description |
|---|---|
| private List | declaredParameters
List of SqlParameter objects (may be |
| private String[] | |
| private int | |
| private boolean | |
| private final String | sql
The SQL, which won't change when the parameters change. |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PreparedStatementCreatorFactory(String
the SQL statement to execute sql, int... int array of JDBC types types)Create a new factory with the given SQL and JDBC types. |
| public | PreparedStatementCreatorFactory(String
the SQL statement to execute sql, List<SqlParameter> list of declaredParameters)SqlParameter objectsCreate a new factory with the given SQL and parameters. |
| Modifier and Type | Method and Description |
|---|---|
| public void | addParameter(SqlParameter
the parameter to add to the list of declared parameters param)Add a new declared parameter. |
| public final String | |
| public PreparedStatementCreator | newPreparedStatementCreator(List<?>
list of parameters (may be params)null)Return a new PreparedStatementCreator for the given parameters. |
| public PreparedStatementCreator | newPreparedStatementCreator(Object[]
the parameter array (may be params)null)Return a new PreparedStatementCreator for the given parameters. |
| public PreparedStatementCreator | newPreparedStatementCreator(String
the actual SQL statement to use (if different from
the factory's, for example because of named parameter expanding) sqlToUse, Object[] the parameter array (may be params)null)Return a new PreparedStatementCreator for the given parameters. |
| public PreparedStatementSetter | newPreparedStatementSetter(List<?>
list of parameters (may be params)null)Return a new PreparedStatementSetter for the given parameters. |
| public PreparedStatementSetter | newPreparedStatementSetter(Object[]
the parameter array (may be params)null)Return a new PreparedStatementSetter for the given parameters. |
| public void | |
| public void | setResultSetType(int
the ResultSet type resultSetType)Set whether to use prepared statements that return a specific type of ResultSet. |
| public void | setReturnGeneratedKeys(boolean returnGeneratedKeys)
Set whether prepared statements should be capable of returning auto-generated keys. |
| public void | setUpdatableResults(boolean updatableResults)
Set whether to use prepared statements capable of returning updatable ResultSets. |
| declaredParameters | back to summary |
|---|---|
| private List<SqlParameter> declaredParameters List of SqlParameter objects (may be | |
| generatedKeysColumnNames | back to summary |
|---|---|
| private String[] generatedKeysColumnNames
| |
| resultSetType | back to summary |
|---|---|
| private int resultSetType | |
| returnGeneratedKeys | back to summary |
|---|---|
| private boolean returnGeneratedKeys | |
| sql | back to summary |
|---|---|
| private final String sql The SQL, which won't change when the parameters change. | |
| updatableResults | back to summary |
|---|---|
| private boolean updatableResults | |
| PreparedStatementCreatorFactory | back to summary |
|---|---|
| public PreparedStatementCreatorFactory(String sql) Create a new factory. Will need to add parameters via the
| |
| PreparedStatementCreatorFactory | back to summary |
|---|---|
| public PreparedStatementCreatorFactory(String sql, int... types) Create a new factory with the given SQL and JDBC types.
| |
| PreparedStatementCreatorFactory | back to summary |
|---|---|
| public PreparedStatementCreatorFactory(String sql, List<SqlParameter> declaredParameters) Create a new factory with the given SQL and parameters.
| |
| addParameter | back to summary |
|---|---|
| public void addParameter(SqlParameter param) Add a new declared parameter. Order of parameter addition is significant.
| |
| getSql | back to summary |
|---|---|
| public final String getSql() Return the SQL statement to execute.
| |
| newPreparedStatementCreator | back to summary |
|---|---|
| public PreparedStatementCreator newPreparedStatementCreator(List<?> params) Return a new PreparedStatementCreator for the given parameters.
| |
| newPreparedStatementCreator | back to summary |
|---|---|
| public PreparedStatementCreator newPreparedStatementCreator(Object[] params) Return a new PreparedStatementCreator for the given parameters.
| |
| newPreparedStatementCreator | back to summary |
|---|---|
| public PreparedStatementCreator newPreparedStatementCreator(String sqlToUse, Object[] params) Return a new PreparedStatementCreator for the given parameters. | |
| newPreparedStatementSetter | back to summary |
|---|---|
| public PreparedStatementSetter newPreparedStatementSetter(List<?> params) Return a new PreparedStatementSetter for the given parameters.
| |
| newPreparedStatementSetter | back to summary |
|---|---|
| public PreparedStatementSetter newPreparedStatementSetter(Object[] params) Return a new PreparedStatementSetter for the given parameters.
| |
| setGeneratedKeysColumnNames | back to summary |
|---|---|
| public void setGeneratedKeysColumnNames(String... names) Set the column names of the auto-generated keys. | |
| setResultSetType | back to summary |
|---|---|
| public void setResultSetType(int resultSetType) Set whether to use prepared statements that return a specific type of ResultSet.
| |
| setReturnGeneratedKeys | back to summary |
|---|---|
| public void setReturnGeneratedKeys(boolean returnGeneratedKeys) Set whether prepared statements should be capable of returning auto-generated keys. | |
| setUpdatableResults | back to summary |
|---|---|
| public void setUpdatableResults(boolean updatableResults) Set whether to use prepared statements capable of returning updatable ResultSets. | |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | cleanupParameters()
Implements org. Close the resources allocated by parameters that the implementing object holds, for example in case of a DisposableSqlTypeValue (like an SqlLobValue). |
| public PreparedStatement | createPreparedStatement(Connection
the connection used to create statement con)Implements org. Create a statement in this connection. |
| public String | getSql()
Implements org. Return the SQL string for this object, i.e. typically the SQL used for creating statements. |
| public void | setValues(PreparedStatement
the PreparedStatement to invoke setter methods on ps)Implements org. Set parameter values on the given PreparedStatement. |
| public String |
| actualSql | back to summary |
|---|---|
| private final String actualSql | |
| parameters | back to summary |
|---|---|
| private final List<?> parameters | |
| PreparedStatementCreatorImpl | back to summary |
|---|---|
| public PreparedStatementCreatorImpl(List<?> parameters) | |
| PreparedStatementCreatorImpl | back to summary |
|---|---|
| public PreparedStatementCreatorImpl(String actualSql, List<?> parameters) | |
| cleanupParameters | back to summary |
|---|---|
| public void cleanupParameters() Implements org. Doc from org. Close the resources allocated by parameters that the implementing object holds, for example in case of a DisposableSqlTypeValue (like an SqlLobValue).
| |
| createPreparedStatement | back to summary |
|---|---|
| public PreparedStatement createPreparedStatement(Connection con) throws SQLException Implements org. Doc from org. Create a statement in this connection. Allows implementations to use PreparedStatements. The JdbcTemplate will close the created statement.
| |
| getSql | back to summary |
|---|---|
| public String getSql() Implements org. Doc from org. Return the SQL string for this object, i.e. typically the SQL used for creating statements. | |
| setValues | back to summary |
|---|---|
| public void setValues(PreparedStatement ps) throws SQLException Implements org. Doc from org. Set parameter values on the given PreparedStatement.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |