@PersistenceContext
)@Deprecated public abstract class JpaDaoSupport extends DaoSupport
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
.
logger
Constructor and Description |
---|
JpaDaoSupport()
Deprecated.
|
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.
|
afterPropertiesSet, initDao
public final void setEntityManagerFactory(EntityManagerFactory entityManagerFactory)
protected JpaTemplate createJpaTemplate(EntityManagerFactory entityManagerFactory)
Can be overridden in subclasses to provide a JpaTemplate instance with different configuration, or a custom JpaTemplate subclass.
entityManagerFactory
- the JPA EntityManagerFactory to create a JpaTemplate forsetEntityManagerFactory(javax.persistence.EntityManagerFactory)
public final void setEntityManager(EntityManager entityManager)
protected JpaTemplate createJpaTemplate(EntityManager entityManager)
Can be overridden in subclasses to provide a JpaTemplate instance with different configuration, or a custom JpaTemplate subclass.
entityManager
- the JPA EntityManager to create a JpaTemplate forsetEntityManagerFactory(javax.persistence.EntityManagerFactory)
public final void setJpaTemplate(JpaTemplate jpaTemplate)
public final JpaTemplate getJpaTemplate()
protected final void checkDaoConfig()
DaoSupport
Implementors should be marked as final
if concrete subclasses
are not supposed to override this template method themselves.
checkDaoConfig
in class DaoSupport