站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

PreparedStatementCreatorFactory (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.jdbc.core
Class PreparedStatementCreatorFactory

java.lang.Object
  extended by org.springframework.jdbc.core.PreparedStatementCreatorFactory

public class PreparedStatementCreatorFactory
extends Object

Helper class that can efficiently create multiple PreparedStatementCreator objects with different parameters based on a SQL statement and a single set of parameter declarations.

Author:
Rod Johnson, Juergen Hoeller

Constructor Summary
PreparedStatementCreatorFactory(String sql)
          Create a new factory.
PreparedStatementCreatorFactory(String sql, int[] types)
          Create a new factory with the given SQL and JDBC types.
PreparedStatementCreatorFactory(String sql, List declaredParameters)
          Create a new factory with the given SQL and parameters.
 
Method Summary
 void addParameter(SqlParameter param)
          Add a new declared parameter.
 PreparedStatementCreator newPreparedStatementCreator(List params)
          Return a new PreparedStatementCreator for the given parameters.
 PreparedStatementCreator newPreparedStatementCreator(Object[] params)
          Return a new PreparedStatementCreator for the given parameters.
 PreparedStatementSetter newPreparedStatementSetter(List params)
          Return a new PreparedStatementSetter for the given parameters.
 PreparedStatementSetter newPreparedStatementSetter(Object[] params)
          Return a new PreparedStatementSetter for the given parameters.
 void setGeneratedKeysColumnNames(String[] names)
          Set the column names of the auto-generated keys.
 void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor)
          Specify the NativeJdbcExtractor to use for unwrapping PreparedStatements, if any.
 void setResultSetType(int resultSetType)
          Set whether to use prepared statements that return a specific type of ResultSet.
 void setReturnGeneratedKeys(boolean returnGeneratedKeys)
          Set whether prepared statements should be capable of returning auto-generated keys.
 void setUpdatableResults(boolean updatableResults)
          Set whether to use prepared statements capable of returning updatable ResultSets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreparedStatementCreatorFactory

public PreparedStatementCreatorFactory(String sql)
Create a new factory. Will need to add parameters via the addParameter() method or have no parameters.


PreparedStatementCreatorFactory

public PreparedStatementCreatorFactory(String sql,
                                       int[] types)
Create a new factory with the given SQL and JDBC types.

Parameters:
sql - SQL to execute
types - int array of JDBC types

PreparedStatementCreatorFactory

public PreparedStatementCreatorFactory(String sql,
                                       List declaredParameters)
Create a new factory with the given SQL and parameters.

Parameters:
sql - SQL
declaredParameters - list of SqlParameter objects
See Also:
SqlParameter
Method Detail

addParameter

public void addParameter(SqlParameter param)
Add a new declared parameter. Order of parameter addition is significant.


setResultSetType

public void setResultSetType(int resultSetType)
Set whether to use prepared statements that return a specific type of ResultSet.

Parameters:
resultSetType - the ResultSet type
See Also:
ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE

setUpdatableResults

public void setUpdatableResults(boolean updatableResults)
Set whether to use prepared statements capable of returning updatable ResultSets.

Parameters:
updatableResults - Set to true for an updatable ResultSet.

setReturnGeneratedKeys

public void setReturnGeneratedKeys(boolean returnGeneratedKeys)
Set whether prepared statements should be capable of returning auto-generated keys.


setGeneratedKeysColumnNames

public void setGeneratedKeysColumnNames(String[] names)
Set the column names of the auto-generated keys.


setNativeJdbcExtractor

public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor)
Specify the NativeJdbcExtractor to use for unwrapping PreparedStatements, if any.


newPreparedStatementCreator

public PreparedStatementCreator newPreparedStatementCreator(Object[] params)
Return a new PreparedStatementCreator for the given parameters.

Parameters:
params - parameter array. May be null.

newPreparedStatementCreator

public PreparedStatementCreator newPreparedStatementCreator(List params)
Return a new PreparedStatementCreator for the given parameters.

Parameters:
params - List of parameters. May be null.

newPreparedStatementSetter

public PreparedStatementSetter newPreparedStatementSetter(Object[] params)
Return a new PreparedStatementSetter for the given parameters.

Parameters:
params - parameter array. May be null.

newPreparedStatementSetter

public PreparedStatementSetter newPreparedStatementSetter(List params)
Return a new PreparedStatementSetter for the given parameters.

Parameters:
params - List of parameters. May be null.


Copyright (c) 2002-2007 The Spring Framework Project.