org.springframework.batch.item.database.orm

## Class AbstractJpaQueryProvider

- java.lang.Object
- - org.springframework.batch.item.database.orm.AbstractJpaQueryProvider

- All Implemented Interfaces:
    JpaQueryProvider, org.springframework.beans.factory.InitializingBean
  Direct Known Subclasses:
    JpaNamedQueryProvider, JpaNativeQueryProvider

      public abstract class AbstractJpaQueryProvider
      extends java.lang.Object
      implements JpaQueryProvider, org.springframework.beans.factory.InitializingBean

  Abstract JPA Query Provider to serve as a base class for all JPA `Query` providers.

  Since:
    2.1
  Author:
    Anatoly Polinsky, Dave Syer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractJpaQueryProvider()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected javax.persistence.EntityManager` | `getEntityManager()` Getter for `EntityManager`
    `void` | `setEntityManager(javax.persistence.EntityManager entityManager)` Public setter to override the entityManager that was created by this `HibernateQueryProvider`.

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

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

    - ### Methods inherited from interface org.springframework.batch.item.database.orm.JpaQueryProvider

      `createQuery`

    - ### Methods inherited from interface org.springframework.beans.factory.InitializingBean

      `afterPropertiesSet`

- - ### Constructor Detail

    - #### AbstractJpaQueryProvider

          public AbstractJpaQueryProvider()

  - ### Method Detail

    - #### setEntityManager

          public void setEntityManager(javax.persistence.EntityManager entityManager)

      Public setter to override the entityManager that was created by this `HibernateQueryProvider`. This is currently needed to allow `HibernateQueryProvider` to participate in a user's managed transaction.

      Specified by:
        `setEntityManager` in interface `JpaQueryProvider`
      Parameters:
        `entityManager` - EntityManager to use

    - #### getEntityManager

          protected javax.persistence.EntityManager getEntityManager()

      Getter for `EntityManager`

      Returns:
        entityManager the injected `EntityManager`