JpaDaoSupport (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.orm.jpa.support

## Class JpaDaoSupport

- java.lang.Object
- - org.springframework.dao.support.DaoSupport
  - - org.springframework.orm.jpa.support.JpaDaoSupport

- All Implemented Interfaces:
    InitializingBean

  Deprecated.
  as of Spring 3.1, in favor of native EntityManager usage (typically obtained through `@PersistenceContext`)

      @Deprecated
      public abstract class JpaDaoSupport
      extends DaoSupport

  Convenient super class for JPA data access objects. Intended for JpaTemplate usage. Alternatively, JPA-based DAOs can be coded against the plain JPA EntityManagerFactory/EntityManager API.

  Requires an EntityManagerFactory or EntityManager to be set, providing a JpaTemplate based on it to subclasses. Can alternatively be initialized directly via a JpaTemplate, to reuse the latter's settings such as the EntityManagerFactory, JpaDialect, flush mode, etc.

  This class will create its own JpaTemplate if an EntityManagerFactory or EntityManager reference is passed in. A custom JpaTemplate instance can be used through overriding `createJpaTemplate`.

  Since:
    2.0
  Author:
    Juergen Hoeller
  See Also:
    `setEntityManagerFactory(javax.persistence.EntityManagerFactory)`, `setEntityManager(javax.persistence.EntityManager)`, `createJpaTemplate(javax.persistence.EntityManagerFactory)`, `setJpaTemplate(org.springframework.orm.jpa.JpaTemplate)`, `JpaTemplate`

- - ### Field Summary

    - ### Fields inherited from class org.springframework.dao.support.DaoSupport

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JpaDaoSupport()` Deprecated.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `checkDaoConfig()` Deprecated. Abstract subclasses must override this to check their configuration.
    `protected JpaTemplate` | `createJpaTemplate(EntityManager entityManager)` Deprecated. Create a JpaTemplate for the given EntityManager.
    `protected JpaTemplate` | `createJpaTemplate(EntityManagerFactory entityManagerFactory)` Deprecated. Create a JpaTemplate for the given EntityManagerFactory.
    `JpaTemplate` | `getJpaTemplate()` Deprecated. Return the JpaTemplate for this DAO, pre-initialized with the EntityManagerFactory or set explicitly.
    `void` | `setEntityManager(EntityManager entityManager)` Deprecated. Set the JPA EntityManager to be used by this DAO.
    `void` | `setEntityManagerFactory(EntityManagerFactory entityManagerFactory)` Deprecated. Set the JPA EntityManagerFactory to be used by this DAO.
    `void` | `setJpaTemplate(JpaTemplate jpaTemplate)` Deprecated. Set the JpaTemplate for this DAO explicitly, as an alternative to specifying a EntityManagerFactory.

    - ### Methods inherited from class org.springframework.dao.support.DaoSupport

      `afterPropertiesSet, initDao`

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

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

- - ### Constructor Detail

    - #### JpaDaoSupport

          public JpaDaoSupport()

      Deprecated.

  - ### Method Detail

    - #### setEntityManagerFactory

          public final void setEntityManagerFactory(EntityManagerFactory entityManagerFactory)

      Deprecated.
      Set the JPA EntityManagerFactory to be used by this DAO. Will automatically create a JpaTemplate for the given EntityManagerFactory.
      See Also:
        `createJpaTemplate(javax.persistence.EntityManagerFactory)`, `setJpaTemplate(org.springframework.orm.jpa.JpaTemplate)`

    - #### createJpaTemplate

          protected JpaTemplate createJpaTemplate(EntityManagerFactory entityManagerFactory)

      Deprecated.
      Create a JpaTemplate for the given EntityManagerFactory. Only invoked if populating the DAO with a EntityManagerFactory reference!

      Can be overridden in subclasses to provide a JpaTemplate instance with different configuration, or a custom JpaTemplate subclass.

      Parameters:
        `entityManagerFactory` - the JPA EntityManagerFactory to create a JpaTemplate for
      Returns:
        the new JpaTemplate instance
      See Also:
        `setEntityManagerFactory(javax.persistence.EntityManagerFactory)`

    - #### setEntityManager

          public final void setEntityManager(EntityManager entityManager)

      Deprecated.
      Set the JPA EntityManager to be used by this DAO. Will automatically create a JpaTemplate for the given EntityManager.
      See Also:
        `createJpaTemplate(javax.persistence.EntityManagerFactory)`, `setJpaTemplate(org.springframework.orm.jpa.JpaTemplate)`

    - #### createJpaTemplate

          protected JpaTemplate createJpaTemplate(EntityManager entityManager)

      Deprecated.
      Create a JpaTemplate for the given EntityManager. Only invoked if populating the DAO with a EntityManager reference!

      Can be overridden in subclasses to provide a JpaTemplate instance with different configuration, or a custom JpaTemplate subclass.

      Parameters:
        `entityManager` - the JPA EntityManager to create a JpaTemplate for
      Returns:
        the new JpaTemplate instance
      See Also:
        `setEntityManagerFactory(javax.persistence.EntityManagerFactory)`

    - #### setJpaTemplate

          public final void setJpaTemplate(JpaTemplate jpaTemplate)

      Deprecated.
      Set the JpaTemplate for this DAO explicitly, as an alternative to specifying a EntityManagerFactory.
      See Also:
        `setEntityManagerFactory(javax.persistence.EntityManagerFactory)`

    - #### getJpaTemplate

          public final JpaTemplate getJpaTemplate()

      Deprecated.
      Return the JpaTemplate for this DAO, pre-initialized with the EntityManagerFactory or set explicitly.

    - #### checkDaoConfig

          protected final void checkDaoConfig()

      Deprecated.
      Description copied from class: `DaoSupport`
      Abstract subclasses must override this to check their configuration.

      Implementors should be marked as `final` if concrete subclasses are not supposed to override this template method themselves.

      Specified by:
        `checkDaoConfig` in class `DaoSupport`