org.springframework.batch.core.repository.support

## Class JobRepositoryFactoryBean

- java.lang.Object
- - org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean
  - - org.springframework.batch.core.repository.support.JobRepositoryFactoryBean

- All Implemented Interfaces:
    org.springframework.beans.factory.FactoryBean<JobRepository>, org.springframework.beans.factory.InitializingBean

      public class JobRepositoryFactoryBean
      extends AbstractJobRepositoryFactoryBean
      implements org.springframework.beans.factory.InitializingBean

  A `FactoryBean` that automates the creation of a `SimpleJobRepository` using JDBC DAO implementations which persist batch metadata in database. Requires the user to describe what kind of database they are using.
  Author:
    Ben Hale, Lucas Ward, Dave Syer, Michael Minella

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.apache.commons.logging.Log` | `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JobRepositoryFactoryBean()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterPropertiesSet()`
    `protected ExecutionContextDao` | `createExecutionContextDao()`
    `protected JobExecutionDao` | `createJobExecutionDao()`
    `protected JobInstanceDao` | `createJobInstanceDao()`
    `protected StepExecutionDao` | `createStepExecutionDao()`
    `void` | `setClobType(int type)`
    `void` | `setDatabaseType(java.lang.String dbType)` Sets the database type.
    `void` | `setDataSource(javax.sql.DataSource dataSource)` Public setter for the `DataSource`.
    `void` | `setIncrementerFactory(DataFieldMaxValueIncrementerFactory incrementerFactory)`
    `void` | `setJdbcOperations(org.springframework.jdbc.core.JdbcOperations jdbcOperations)` Public setter for the `JdbcOperations`.
    `void` | `setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)` A special handler for large objects.
    `void` | `setMaxVarCharLength(int maxVarCharLength)` Public setter for the length of long string columns in database.
    `void` | `setSerializer(ExecutionContextSerializer serializer)` A custom implementation of the `ExecutionContextSerializer`.
    `void` | `setTablePrefix(java.lang.String tablePrefix)` Sets the table prefix for all the batch meta-data tables.

    - ### Methods inherited from class org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean

      `getJobRepository, getObject, getObjectType, getTransactionManager, isSingleton, setIsolationLevelForCreate, setTransactionManager, setValidateTransactionState`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

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

  - ### Constructor Detail

    - #### JobRepositoryFactoryBean

          public JobRepositoryFactoryBean()

  - ### Method Detail

    - #### setClobType

          public void setClobType(int type)

      Parameters:
        `type` - a value from the `Types` class to indicate the type to use for a CLOB

    - #### setSerializer

          public void setSerializer(ExecutionContextSerializer serializer)

      A custom implementation of the `ExecutionContextSerializer`. The default, if not injected, is the `XStreamExecutionContextStringSerializer`.
      Parameters:
        `serializer` - used to serialize/deserialize `ExecutionContext`
      See Also:
        `ExecutionContextSerializer`

    - #### setLobHandler

          public void setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)

      A special handler for large objects. The default is usually fine, except for some (usually older) versions of Oracle. The default is determined from the data base type.
      Parameters:
        `lobHandler` - the `LobHandler` to set
      See Also:
        `LobHandler`

    - #### setMaxVarCharLength

          public void setMaxVarCharLength(int maxVarCharLength)

      Public setter for the length of long string columns in database. Do not set this if you haven't modified the schema. Note this value will be used for the exit message in both `JdbcJobExecutionDao` and `JdbcStepExecutionDao` and also the short version of the execution context in `JdbcExecutionContextDao` . For databases with multi-byte character sets this number can be smaller (by up to a factor of 2 for 2-byte characters) than the declaration of the column length in the DDL for the tables.
      Parameters:
        `maxVarCharLength` - the exitMessageLength to set

    - #### setDataSource

          public void setDataSource(javax.sql.DataSource dataSource)

      Public setter for the `DataSource`.
      Parameters:
        `dataSource` - a `DataSource`

    - #### setJdbcOperations

          public void setJdbcOperations(org.springframework.jdbc.core.JdbcOperations jdbcOperations)

      Public setter for the `JdbcOperations`. If this property is not set explicitly, a new `JdbcTemplate` will be created for the configured DataSource by default.
      Parameters:
        `jdbcOperations` - a `JdbcOperations`

    - #### setDatabaseType

          public void setDatabaseType(java.lang.String dbType)

      Sets the database type.
      Parameters:
        `dbType` - as specified by `DefaultDataFieldMaxValueIncrementerFactory`

    - #### setTablePrefix

          public void setTablePrefix(java.lang.String tablePrefix)

      Sets the table prefix for all the batch meta-data tables.
      Parameters:
        `tablePrefix` - prefix prepended to batch meta-data tables

    - #### setIncrementerFactory

          public void setIncrementerFactory(DataFieldMaxValueIncrementerFactory incrementerFactory)

    - #### afterPropertiesSet

          public void afterPropertiesSet()
                                  throws java.lang.Exception

      Specified by:
        `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
      Overrides:
        `afterPropertiesSet` in class `AbstractJobRepositoryFactoryBean`
      Throws:
        `java.lang.Exception`

    - #### createJobInstanceDao

          protected JobInstanceDao createJobInstanceDao()
                                                 throws java.lang.Exception

      Specified by:
        `createJobInstanceDao` in class `AbstractJobRepositoryFactoryBean`
      Returns:
        fully configured `JobInstanceDao` implementation.
      Throws:
        `java.lang.Exception`

    - #### createJobExecutionDao

          protected JobExecutionDao createJobExecutionDao()
                                                   throws java.lang.Exception

      Specified by:
        `createJobExecutionDao` in class `AbstractJobRepositoryFactoryBean`
      Returns:
        fully configured `JobExecutionDao` implementation.
      Throws:
        `java.lang.Exception`

    - #### createStepExecutionDao

          protected StepExecutionDao createStepExecutionDao()
                                                     throws java.lang.Exception

      Specified by:
        `createStepExecutionDao` in class `AbstractJobRepositoryFactoryBean`
      Returns:
        fully configured `StepExecutionDao` implementation.
      Throws:
        `java.lang.Exception`

    - #### createExecutionContextDao

          protected ExecutionContextDao createExecutionContextDao()
                                                           throws java.lang.Exception

      Specified by:
        `createExecutionContextDao` in class `AbstractJobRepositoryFactoryBean`
      Returns:
        fully configured `ExecutionContextDao` implementation.
      Throws:
        `java.lang.Exception`