org.springframework.batch.item.database.builder

## Class JpaItemWriterBuilder<T>

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

-     public class JpaItemWriterBuilder<T>
      extends java.lang.Object

  A builder for the `JpaItemWriter`.
  Since:
    4.1
  Author:
    Mahmoud Ben Hassine
  See Also:
    `JpaItemWriter`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JpaItemWriterBuilder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `JpaItemWriter<T>` | `build()` Returns a fully built `JpaItemWriter`.
    `JpaItemWriterBuilder<T>` | `entityManagerFactory(javax.persistence.EntityManagerFactory entityManagerFactory)` The JPA `EntityManagerFactory` to obtain an entity manager from.
    `JpaItemWriterBuilder<T>` | `usePersist(boolean usePersist)` Set whether the entity manager should perform a persist instead of a merge.

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

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

- - ### Constructor Detail

    - #### JpaItemWriterBuilder

          public JpaItemWriterBuilder()

  - ### Method Detail

    - #### entityManagerFactory

          public JpaItemWriterBuilder<T> entityManagerFactory(javax.persistence.EntityManagerFactory entityManagerFactory)

      The JPA `EntityManagerFactory` to obtain an entity manager from. Required.
      Parameters:
        `entityManagerFactory` - the `EntityManagerFactory`
      Returns:
        this instance for method chaining
      See Also:
        `JpaItemWriter.setEntityManagerFactory(EntityManagerFactory)`

    - #### usePersist

          public JpaItemWriterBuilder<T> usePersist(boolean usePersist)

      Set whether the entity manager should perform a persist instead of a merge.
      Parameters:
        `usePersist` - defaults to false
      Returns:
        this instance for method chaining
      See Also:
        `JpaItemWriter.setUsePersist(boolean)`

    - #### build

          public JpaItemWriter<T> build()

      Returns a fully built `JpaItemWriter`.
      Returns:
        the writer