Package org.springframework.batch.item.database.builder

# Class HibernateItemWriterBuilder<T>

java.lang.Object
org.springframework.batch.item.database.builder.HibernateItemWriterBuilder<T>

public class HibernateItemWriterBuilder<T> extends Object
A builder for the `HibernateItemWriter`

Since:
  4.0
Author:
  Michael Minella
See Also:
  - `HibernateItemWriter`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HibernateItemWriterBuilder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `HibernateItemWriter<T>`
  `build()`
  Returns a fully built `HibernateItemWriter`
  `HibernateItemWriterBuilder<T>`
  `clearSession(boolean clearSession)`
  If set to false, the `Session` will not be cleared at the end of the chunk.
  `HibernateItemWriterBuilder<T>`
  `sessionFactory(org.hibernate.SessionFactory sessionFactory)`
  The Hibernate `SessionFactory` to obtain a session from.

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

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

- ## Constructor Details

  - ### HibernateItemWriterBuilder

    public HibernateItemWriterBuilder()

- ## Method Details

  - ### clearSession

    public HibernateItemWriterBuilder<T> clearSession(boolean clearSession)
    If set to false, the `Session` will not be cleared at the end of the chunk.
    Parameters:
      `clearSession` - defaults to true
    Returns:
      this instance for method chaining
    See Also:
      - `HibernateItemWriter.setClearSession(boolean)`

  - ### sessionFactory

    public HibernateItemWriterBuilder<T> sessionFactory(org.hibernate.SessionFactory sessionFactory)
    The Hibernate `SessionFactory` to obtain a session from. Required.
    Parameters:
      `sessionFactory` - the `SessionFactory`
    Returns:
      this instance for method chaining
    See Also:
      - `HibernateItemWriter.setSessionFactory(SessionFactory)`

  - ### build

    public HibernateItemWriter<T> build()
    Returns a fully built `HibernateItemWriter`
    Returns:
      the writer