Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.jdbc.core.simple
Class AbstractJdbcInsert

    java.lang.Object
      org.springframework.jdbc.core.simple.AbstractJdbcInsert

Direct Known Subclasses:
  SimpleJdbcInsert

    public abstract class AbstractJdbcInsert

extends java.lang.Object

Abstract class to provide base functionality for easy inserts based on configuration options and database metadata. This class provides the base SPI for `SimpleJdbcInsert`.

Since:
  2.5
Author:
  Thomas Risberg, Juergen Hoeller

Field Summary
`protected org.apache.commons.logging.Log` | `logger` Logger available to subclasses

Constructor Summary
`protected` | `AbstractJdbcInsert(javax.sql.DataSource dataSource)` Constructor for sublasses to delegate to for setting the DataSource.
`protected` | `AbstractJdbcInsert(JdbcTemplate jdbcTemplate)` Constructor for sublasses to delegate to for setting the JdbcTemplate.

Method Summary
`protected void` | `checkCompiled()` Check whether this operation has been compiled already; lazily compile it if not already compiled.
`protected void` | `checkIfConfigurationModificationIsAllowed()` Method to check whether we are allowd to make any configuration changes at this time.
`void` | `compile()` Compile this JdbcInsert using provided parameters and meta data plus other settings.
`protected void` | `compileInternal()` Method to perform the actual compilation.
`protected int` | `doExecute(java.util.Map<java.lang.String,java.lang.Object> args)` Method that provides execution of the insert using the passed in Map of parameters
`protected int` | `doExecute(SqlParameterSource parameterSource)` Method that provides execution of the insert using the passed in `SqlParameterSource`
`protected java.lang.Number` | `doExecuteAndReturnKey(java.util.Map<java.lang.String,java.lang.Object> args)` Method that provides execution of the insert using the passed in Map of parameters and returning a generated key
`protected java.lang.Number` | `doExecuteAndReturnKey(SqlParameterSource parameterSource)` Method that provides execution of the insert using the passed in `SqlParameterSource` and returning a generated key
`protected KeyHolder` | `doExecuteAndReturnKeyHolder(java.util.Map<java.lang.String,java.lang.Object> args)` Method that provides execution of the insert using the passed in Map of parameters and returning all generated keys
`protected KeyHolder` | `doExecuteAndReturnKeyHolder(SqlParameterSource parameterSource)` Method that provides execution of the insert using the passed in `SqlParameterSource` and returning all generated keys
`protected int[]` | `doExecuteBatch(java.util.Map<java.lang.String,java.lang.Object>[] batch)` Method that provides execution of a batch insert using the passed in Maps of parameters
`protected int[]` | `doExecuteBatch(SqlParameterSource[] batch)` Method that provides execution of a batch insert using the passed in array of `SqlParameterSource`
`java.lang.String` | `getCatalogName()` Get the name of the catalog for this insert
`java.util.List<java.lang.String>` | `getColumnNames()` Get the names of the columns used
`java.lang.String[]` | `getGeneratedKeyNames()` Get the names of any generated keys
`java.lang.String` | `getInsertString()` Get the insert string to be used
`int[]` | `getInsertTypes()` Get the array of `Types` to be used for insert
`protected JdbcTemplate` | `getJdbcTemplate()` Get the `JdbcTemplate` that is configured to be used
`java.lang.String` | `getSchemaName()` Get the name of the schema for this insert
`java.lang.String` | `getTableName()` Get the name of the table for this insert
`boolean` | `isCompiled()` Is this operation "compiled"?
`protected java.util.List<java.lang.Object>` | `matchInParameterValuesWithInsertColumns(java.util.Map<java.lang.String,java.lang.Object> args)` Match the provided in parameter values with regitered parameters and parameters defined via metedata processing.
`protected java.util.List<java.lang.Object>` | `matchInParameterValuesWithInsertColumns(SqlParameterSource parameterSource)` Match the provided in parameter values with regitered parameters and parameters defined via metedata processing.
`protected void` | `onCompileInternal()` Hook method that subclasses may override to react to compilation.
`void` | `setAccessTableColumnMetaData(boolean accessTableColumnMetaData)` Specify whether the parameter metadata for the call should be used.
`void` | `setCatalogName(java.lang.String catalogName)` Set the name of the catalog for this insert
`void` | `setColumnNames(java.util.List<java.lang.String> columnNames)` Set the names of the columns to be used
`void` | `setGeneratedKeyName(java.lang.String generatedKeyName)` Specify the name of a single generated key column
`void` | `setGeneratedKeyNames(java.lang.String[] generatedKeyNames)` Set the names of any generated keys
`void` | `setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor)` Set the `NativeJdbcExtractor` to use to retrieve the native connection if necessary
`void` | `setOverrideIncludeSynonymsDefault(boolean override)` Specify whether the default for including synonyms should be changed.
`void` | `setSchemaName(java.lang.String schemaName)` Set the name of the schema for this insert
`void` | `setTableName(java.lang.String tableName)` Set the name of the table for this insert

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### logger

    protected final org.apache.commons.logging.Log logger

  Logger available to subclasses

Constructor Detail

### AbstractJdbcInsert

    protected AbstractJdbcInsert(javax.sql.DataSource dataSource)

  Constructor for sublasses to delegate to for setting the DataSource.

### AbstractJdbcInsert

    protected AbstractJdbcInsert(JdbcTemplate jdbcTemplate)

  Constructor for sublasses to delegate to for setting the JdbcTemplate.

Method Detail

### setTableName

    public void setTableName(java.lang.String tableName)

  Set the name of the table for this insert

### getTableName

    public java.lang.String getTableName()

  Get the name of the table for this insert

### setSchemaName

    public void setSchemaName(java.lang.String schemaName)

  Set the name of the schema for this insert

### getSchemaName

    public java.lang.String getSchemaName()

  Get the name of the schema for this insert

### setCatalogName

    public void setCatalogName(java.lang.String catalogName)

  Set the name of the catalog for this insert

### getCatalogName

    public java.lang.String getCatalogName()

  Get the name of the catalog for this insert

### setColumnNames

    public void setColumnNames(java.util.List<java.lang.String> columnNames)

  Set the names of the columns to be used

### getColumnNames

    public java.util.List<java.lang.String> getColumnNames()

  Get the names of the columns used

### getGeneratedKeyNames

    public java.lang.String[] getGeneratedKeyNames()

  Get the names of any generated keys

### setGeneratedKeyNames

    public void setGeneratedKeyNames(java.lang.String[] generatedKeyNames)

  Set the names of any generated keys

### setGeneratedKeyName

    public void setGeneratedKeyName(java.lang.String generatedKeyName)

  Specify the name of a single generated key column

### setAccessTableColumnMetaData

    public void setAccessTableColumnMetaData(boolean accessTableColumnMetaData)

  Specify whether the parameter metadata for the call should be used. The default is true.

### setOverrideIncludeSynonymsDefault

    public void setOverrideIncludeSynonymsDefault(boolean override)

  Specify whether the default for including synonyms should be changed. The default is false.

### setNativeJdbcExtractor

    public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor)

  Set the `NativeJdbcExtractor` to use to retrieve the native connection if necessary

### getInsertString

    public java.lang.String getInsertString()

  Get the insert string to be used

### getInsertTypes

    public int[] getInsertTypes()

  Get the array of `Types` to be used for insert

### getJdbcTemplate

    protected JdbcTemplate getJdbcTemplate()

  Get the `JdbcTemplate` that is configured to be used

### compile

    public final void compile()
                       throws InvalidDataAccessApiUsageException

  Compile this JdbcInsert using provided parameters and meta data plus other settings. This finalizes the configuration for this object and subsequent attempts to compile are ignored. This will be implicitly called the first time an un-compiled insert is executed.

  Throws:
    `InvalidDataAccessApiUsageException` - if the object hasn't been correctly initialized, for example if no DataSource has been provided

### compileInternal

    protected void compileInternal()

  Method to perform the actual compilation. Subclasses can override this template method to perform their own compilation. Invoked after this base class's compilation is complete.

### onCompileInternal

    protected void onCompileInternal()

  Hook method that subclasses may override to react to compilation. This implementation does nothing.

### isCompiled

    public boolean isCompiled()

  Is this operation "compiled"?

  Returns:
    whether this operation is compiled, and ready to use.

### checkCompiled

    protected void checkCompiled()

  Check whether this operation has been compiled already; lazily compile it if not already compiled.

  Automatically called by `validateParameters`.

### checkIfConfigurationModificationIsAllowed

    protected void checkIfConfigurationModificationIsAllowed()

  Method to check whether we are allowd to make any configuration changes at this time. If the class has been compiled, then no further changes to the configuration are allowed.

### doExecute

    protected int doExecute(java.util.Map<java.lang.String,java.lang.Object> args)

  Method that provides execution of the insert using the passed in Map of parameters

  Parameters:
    `args` - Map with parameter names and values to be used in insert
  Returns:
    number of rows affected

### doExecute

    protected int doExecute(SqlParameterSource parameterSource)

  Method that provides execution of the insert using the passed in `SqlParameterSource`

  Parameters:
    `parameterSource` - parameter names and values to be used in insert
  Returns:
    number of rows affected

### doExecuteAndReturnKey

    protected java.lang.Number doExecuteAndReturnKey(java.util.Map<java.lang.String,java.lang.Object> args)

  Method that provides execution of the insert using the passed in Map of parameters and returning a generated key

  Parameters:
    `args` - Map with parameter names and values to be used in insert
  Returns:
    the key generated by the insert

### doExecuteAndReturnKey

    protected java.lang.Number doExecuteAndReturnKey(SqlParameterSource parameterSource)

  Method that provides execution of the insert using the passed in `SqlParameterSource` and returning a generated key

  Parameters:
    `parameterSource` - parameter names and values to be used in insert
  Returns:
    the key generated by the insert

### doExecuteAndReturnKeyHolder

    protected KeyHolder doExecuteAndReturnKeyHolder(java.util.Map<java.lang.String,java.lang.Object> args)

  Method that provides execution of the insert using the passed in Map of parameters and returning all generated keys

  Parameters:
    `args` - Map with parameter names and values to be used in insert
  Returns:
    the KeyHolder containing keys generated by the insert

### doExecuteAndReturnKeyHolder

    protected KeyHolder doExecuteAndReturnKeyHolder(SqlParameterSource parameterSource)

  Method that provides execution of the insert using the passed in `SqlParameterSource` and returning all generated keys

  Parameters:
    `parameterSource` - parameter names and values to be used in insert
  Returns:
    the KeyHolder containing keys generated by the insert

### doExecuteBatch

    protected int[] doExecuteBatch(java.util.Map<java.lang.String,java.lang.Object>[] batch)

  Method that provides execution of a batch insert using the passed in Maps of parameters

  Parameters:
    `batch` - array of Maps with parameter names and values to be used in batch insert
  Returns:
    array of number of rows affected

### doExecuteBatch

    protected int[] doExecuteBatch(SqlParameterSource[] batch)

  Method that provides execution of a batch insert using the passed in array of `SqlParameterSource`

  Parameters:
    `batch` - array of SqlParameterSource with parameter names and values to be used in insert
  Returns:
    array of number of rows affected

### matchInParameterValuesWithInsertColumns

    protected java.util.List<java.lang.Object> matchInParameterValuesWithInsertColumns(SqlParameterSource parameterSource)

  Match the provided in parameter values with regitered parameters and parameters defined via metedata processing.

  Parameters:
    `parameterSource` - the parameter vakues provided as a `SqlParameterSource`
  Returns:
    Map with parameter names and values

### matchInParameterValuesWithInsertColumns

    protected java.util.List<java.lang.Object> matchInParameterValuesWithInsertColumns(java.util.Map<java.lang.String,java.lang.Object> args)

  Match the provided in parameter values with regitered parameters and parameters defined via metedata processing.

  Parameters:
    `args` - the parameter values provided in a Map
  Returns:
    Map with parameter names and values

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD