Package org.springframework.batch.core.repository.dao

# Class JdbcExecutionContextDao

java.lang.Object
org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
org.springframework.batch.core.repository.dao.JdbcExecutionContextDao

All Implemented Interfaces:
  `ExecutionContextDao`, `org.springframework.beans.factory.InitializingBean`

public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implements ExecutionContextDao
JDBC DAO for `ExecutionContext`. Stores execution context data related to both Step and Job using a different table for each.

Author:
  Lucas Ward, Robert Kasanicky, Thomas Risberg, Michael Minella, David Turanski, Mahmoud Ben Hassine

- ## Field Summary

  ### Fields inherited from class org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao

  `DEFAULT_EXIT_MESSAGE_LENGTH, DEFAULT_TABLE_PREFIX`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JdbcExecutionContextDao()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `afterPropertiesSet()`
  `ExecutionContext`
  `getExecutionContext(JobExecution jobExecution)`
  `ExecutionContext`
  `getExecutionContext(StepExecution stepExecution)`
  `void`
  `saveExecutionContext(JobExecution jobExecution)`
  Persist the execution context associated with the given jobExecution, persistent entry for the context should not exist yet.
  `void`
  `saveExecutionContext(StepExecution stepExecution)`
  Persist the execution context associated with the given stepExecution, persistent entry for the context should not exist yet.
  `void`
  `saveExecutionContexts(Collection<StepExecution> stepExecutions)`
  Persist the execution context associated with each stepExecution in a given collection, persistent entry for the context should not exist yet.
  `void`
  `setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)`
  `void`
  `setSerializer(ExecutionContextSerializer serializer)`
  Setter for `Serializer` implementation
  `void`
  `setShortContextLength(int shortContextLength)`
  The maximum size that an execution context can have and still be stored completely in short form in the column `SHORT_CONTEXT`.
  `void`
  `updateExecutionContext(JobExecution jobExecution)`
  Persist the updates of execution context associated with the given jobExecution.
  `void`
  `updateExecutionContext(StepExecution stepExecution)`
  Persist the updates of execution context associated with the given stepExecution.

  ### Methods inherited from class org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao

  `getClobTypeToUse, getJdbcTemplate, getQuery, getTablePrefix, setClobTypeToUse, setJdbcTemplate, setTablePrefix`

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

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

- ## Constructor Details

  - ### JdbcExecutionContextDao

    public JdbcExecutionContextDao()

- ## Method Details

  - ### setSerializer

    public void setSerializer(ExecutionContextSerializer serializer)
    Setter for `Serializer` implementation
    Parameters:
      `serializer` - `ExecutionContextSerializer` instance to use.

  - ### setShortContextLength

    public void setShortContextLength(int shortContextLength)
    The maximum size that an execution context can have and still be stored completely in short form in the column `SHORT_CONTEXT`. Anything longer than this will overflow into large-object storage, and the first part only will be retained in the short form for readability. Default value is 2500. Clients using multi-bytes charsets on the database server may need to reduce this value to as little as half the value of the column size.
    Parameters:
      `shortContextLength` - int max length of the short context.

  - ### getExecutionContext

    public ExecutionContext getExecutionContext(JobExecution jobExecution)
    Specified by:
      `getExecutionContext` in interface `ExecutionContextDao`
    Parameters:
      `jobExecution` - `JobExecution` instance that contains the context.
    Returns:
      execution context associated with the given jobExecution

  - ### getExecutionContext

    public ExecutionContext getExecutionContext(StepExecution stepExecution)
    Specified by:
      `getExecutionContext` in interface `ExecutionContextDao`
    Parameters:
      `stepExecution` - `StepExecution` instance that contains the context.
    Returns:
      execution context associated with the given stepExecution

  - ### updateExecutionContext

    public void updateExecutionContext(JobExecution jobExecution)
    Description copied from interface: `ExecutionContextDao`
    Persist the updates of execution context associated with the given jobExecution. Persistent entry should already exist for this context.
    Specified by:
      `updateExecutionContext` in interface `ExecutionContextDao`
    Parameters:
      `jobExecution` - `JobExecution` instance that contains the context.

  - ### updateExecutionContext

    public void updateExecutionContext(StepExecution stepExecution)
    Description copied from interface: `ExecutionContextDao`
    Persist the updates of execution context associated with the given stepExecution. Persistent entry should already exist for this context.
    Specified by:
      `updateExecutionContext` in interface `ExecutionContextDao`
    Parameters:
      `stepExecution` - `StepExecution` instance that contains the context.

  - ### saveExecutionContext

    public void saveExecutionContext(JobExecution jobExecution)
    Description copied from interface: `ExecutionContextDao`
    Persist the execution context associated with the given jobExecution, persistent entry for the context should not exist yet.
    Specified by:
      `saveExecutionContext` in interface `ExecutionContextDao`
    Parameters:
      `jobExecution` - `JobExecution` instance that contains the context.

  - ### saveExecutionContext

    public void saveExecutionContext(StepExecution stepExecution)
    Description copied from interface: `ExecutionContextDao`
    Persist the execution context associated with the given stepExecution, persistent entry for the context should not exist yet.
    Specified by:
      `saveExecutionContext` in interface `ExecutionContextDao`
    Parameters:
      `stepExecution` - `StepExecution` instance that contains the context.

  - ### saveExecutionContexts

    public void saveExecutionContexts(Collection<StepExecution> stepExecutions)
    Description copied from interface: `ExecutionContextDao`
    Persist the execution context associated with each stepExecution in a given collection, persistent entry for the context should not exist yet.
    Specified by:
      `saveExecutionContexts` in interface `ExecutionContextDao`
    Parameters:
      `stepExecutions` - a collection of `StepExecution`s that contain the contexts.

  - ### setLobHandler

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

  - ### afterPropertiesSet

    public void afterPropertiesSet() throws Exception
    Specified by:
      `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
    Overrides:
      `afterPropertiesSet` in class `AbstractJdbcBatchMetadataDao`
    Throws:
      `Exception`