private static class EntityManagerFactoryUtils.TransactionalEntityManagerSynchronization extends ResourceHolderSynchronization<EntityManagerHolder,EntityManagerFactory> implements Ordered
JtaTransactionManager
Modifier and Type | Field and Description |
---|---|
private JpaDialect |
jpaDialect |
private boolean |
newEntityManager |
private java.lang.Object |
transactionData |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
STATUS_COMMITTED, STATUS_ROLLED_BACK, STATUS_UNKNOWN
Constructor and Description |
---|
TransactionalEntityManagerSynchronization(EntityManagerHolder emHolder,
EntityManagerFactory emf,
java.lang.Object txData,
boolean newEm) |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanupResource(EntityManagerHolder resourceHolder,
EntityManagerFactory resourceKey,
boolean committed)
Perform a cleanup on the given resource (which is left bound to the thread).
|
protected void |
flushResource(EntityManagerHolder resourceHolder)
Flush callback for the given resource holder.
|
int |
getOrder()
Get the order value of this object.
|
protected void |
releaseResource(EntityManagerHolder resourceHolder,
EntityManagerFactory resourceKey)
Release the given resource (after it has been unbound from the thread).
|
protected boolean |
shouldUnbindAtCompletion()
Return whether this holder should be unbound at completion
(or should rather be left bound to the thread after the transaction).
|
afterCommit, afterCompletion, beforeCommit, beforeCompletion, flush, processResourceAfterCommit, resume, shouldReleaseAfterCompletion, shouldReleaseBeforeCompletion, suspend
private final java.lang.Object transactionData
private final JpaDialect jpaDialect
private final boolean newEntityManager
public TransactionalEntityManagerSynchronization(EntityManagerHolder emHolder, EntityManagerFactory emf, java.lang.Object txData, boolean newEm)
public int getOrder()
Ordered
Higher values are interpreted as lower priority. As a consequence,
the object with the lowest value has the highest priority (somewhat
analogous to Servlet load-on-startup
values).
Same order values will result in arbitrary sort positions for the affected objects.
getOrder
in interface Ordered
Ordered.HIGHEST_PRECEDENCE
,
Ordered.LOWEST_PRECEDENCE
protected void flushResource(EntityManagerHolder resourceHolder)
ResourceHolderSynchronization
flushResource
in class ResourceHolderSynchronization<EntityManagerHolder,EntityManagerFactory>
resourceHolder
- the resource holder to flushprotected boolean shouldUnbindAtCompletion()
ResourceHolderSynchronization
The default implementation returns true
.
shouldUnbindAtCompletion
in class ResourceHolderSynchronization<EntityManagerHolder,EntityManagerFactory>
protected void releaseResource(EntityManagerHolder resourceHolder, EntityManagerFactory resourceKey)
ResourceHolderSynchronization
releaseResource
in class ResourceHolderSynchronization<EntityManagerHolder,EntityManagerFactory>
resourceHolder
- the resource holder to processresourceKey
- the key that the ResourceHolder was bound forprotected void cleanupResource(EntityManagerHolder resourceHolder, EntityManagerFactory resourceKey, boolean committed)
ResourceHolderSynchronization
cleanupResource
in class ResourceHolderSynchronization<EntityManagerHolder,EntityManagerFactory>
resourceHolder
- the resource holder to processresourceKey
- the key that the ResourceHolder was bound forcommitted
- whether the transaction has committed (true
)
or rolled back (false
)