Package org.springframework.orm.jpa

# Class EntityManagerHolder

java.lang.Object
org.springframework.transaction.support.ResourceHolderSupport
org.springframework.orm.jpa.EntityManagerHolder

All Implemented Interfaces:
  `org.springframework.transaction.support.ResourceHolder`

Direct Known Subclasses:
  `SessionHolder`

public class EntityManagerHolder extends org.springframework.transaction.support.ResourceHolderSupport
Resource holder wrapping a JPA `EntityManager`. `JpaTransactionManager` binds instances of this class to the thread, for a given `EntityManagerFactory`.

Also serves as a base class for `SessionHolder`, as of 5.1.

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

Since:
  2.0
Author:
  Juergen Hoeller
See Also:
  - `JpaTransactionManager`
  - `EntityManagerFactoryUtils`

## Constructor Summary

Constructors
Constructor
Description
`EntityManagerHolder(EntityManager entityManager)`

## Method Summary

Modifier and Type
Method
Description
`void`
`clear()`
`EntityManager`
`getEntityManager()`
`protected org.springframework.transaction.SavepointManager`
`getSavepointManager()`
`protected boolean`
`isTransactionActive()`
`protected void`
`setSavepointManager(org.springframework.transaction.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, resetRollbackOnly, setRollbackOnly, setSynchronizedWithTransaction, setTimeoutInMillis, setTimeoutInSeconds, unbound`

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

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

## Constructor Details

### EntityManagerHolder

public EntityManagerHolder(@Nullable EntityManager entityManager)

## Method Details

### getEntityManager

public EntityManager getEntityManager()

### setTransactionActive

protected void setTransactionActive(boolean transactionActive)

### isTransactionActive

protected boolean isTransactionActive()

### setSavepointManager

protected void setSavepointManager(@Nullable org.springframework.transaction.SavepointManager savepointManager)

### getSavepointManager

@Nullable protected org.springframework.transaction.SavepointManager getSavepointManager()

### clear

public void clear()

Overrides:
  `clear` in class `org.springframework.transaction.support.ResourceHolderSupport`