org.springframework.orm.jpa
Class EntityManagerHolder

java.lang.Object
  extended by org.springframework.transaction.support.ResourceHolderSupport
      extended by org.springframework.orm.jpa.EntityManagerHolder
All Implemented Interfaces:
ResourceHolder

public class EntityManagerHolder
extends ResourceHolderSupport

Holder wrapping a JPA EntityManager. JpaTransactionManager binds instances of this class to the thread, for a given EntityManagerFactory.

Note: This is an SPI class, not intended to be used by applications.

Since:
2.0
Author:
Juergen Hoeller
See Also:
JpaTransactionManager, EntityManagerFactoryUtils

Field Summary
private  EntityManager entityManager
           
private  SavepointManager savepointManager
           
private  boolean transactionActive
           
 
Constructor Summary
EntityManagerHolder(EntityManager entityManager)
           
 
Method Summary
 void clear()
          Clear the transactional state of this resource holder.
 EntityManager getEntityManager()
           
protected  SavepointManager getSavepointManager()
           
protected  boolean isTransactionActive()
           
protected  void setSavepointManager(SavepointManager savepointManager)
           
protected  void setTransactionActive(boolean transactionActive)
           
 
Methods inherited from class org.springframework.transaction.support.ResourceHolderSupport
getDeadline, getTimeToLiveInMillis, getTimeToLiveInSeconds, hasTimeout, isOpen, isRollbackOnly, isSynchronizedWithTransaction, isVoid, released, requested, reset, setRollbackOnly, setSynchronizedWithTransaction, setTimeoutInMillis, setTimeoutInSeconds, unbound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entityManager

private final EntityManager entityManager

transactionActive

private boolean transactionActive

savepointManager

private SavepointManager savepointManager
Constructor Detail

EntityManagerHolder

public EntityManagerHolder(EntityManager entityManager)
Method Detail

getEntityManager

public EntityManager getEntityManager()

setTransactionActive

protected void setTransactionActive(boolean transactionActive)

isTransactionActive

protected boolean isTransactionActive()

setSavepointManager

protected void setSavepointManager(SavepointManager savepointManager)

getSavepointManager

protected SavepointManager getSavepointManager()

clear

public void clear()
Description copied from class: ResourceHolderSupport
Clear the transactional state of this resource holder.

Overrides:
clear in class ResourceHolderSupport