@Dependent
@Alternative
public class OsgiUserTransactionStrategy
extends org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy
| Constructor and Description |
|---|
OsgiUserTransactionStrategy() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyTransactionTimeout() |
protected void |
beforeProceed(javax.interceptor.InvocationContext invocationContext,
org.apache.deltaspike.jpa.impl.transaction.context.EntityManagerEntry entityManagerEntry,
javax.persistence.EntityTransaction transaction)
Needed because the
EntityManager might get created outside of the
UserTransaction
(e.g. depending on the implementation of the producer). |
protected org.apache.deltaspike.jpa.api.transaction.TransactionConfig |
createDefaultTransactionConfig() |
protected org.apache.deltaspike.jpa.impl.transaction.context.EntityManagerEntry |
createEntityManagerEntry(javax.persistence.EntityManager entityManager,
Class<? extends Annotation> qualifier) |
protected Integer |
getDefaultTransactionTimeoutInSeconds() |
protected javax.persistence.EntityTransaction |
getTransaction(org.apache.deltaspike.jpa.impl.transaction.context.EntityManagerEntry entityManagerEntry) |
protected void |
lazyInit() |
protected UserTransaction |
resolveUserTransaction() |
protected org.apache.deltaspike.jpa.impl.transaction.context.EntityManagerEntry createEntityManagerEntry(javax.persistence.EntityManager entityManager,
Class<? extends Annotation> qualifier)
createEntityManagerEntry in class org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategyprotected void applyTransactionTimeout()
protected Integer getDefaultTransactionTimeoutInSeconds()
protected void lazyInit()
protected org.apache.deltaspike.jpa.api.transaction.TransactionConfig createDefaultTransactionConfig()
protected javax.persistence.EntityTransaction getTransaction(org.apache.deltaspike.jpa.impl.transaction.context.EntityManagerEntry entityManagerEntry)
getTransaction in class org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategyprotected void beforeProceed(javax.interceptor.InvocationContext invocationContext,
org.apache.deltaspike.jpa.impl.transaction.context.EntityManagerEntry entityManagerEntry,
javax.persistence.EntityTransaction transaction)
EntityManager might get created outside of the
UserTransaction
(e.g. depending on the implementation of the producer).
Can't be in
BeanManagedUserTransactionStrategy.UserTransactionAdapter#begin()
because ResourceLocalTransactionStrategy needs to do
if (!transaction.isActive())
{
transaction.begin();
}
for the EntityTransaction of every EntityManager
and
BeanManagedUserTransactionStrategy.UserTransactionAdapter#isActive()
can only use the status information of the UserTransaction and
therefore
BeanManagedUserTransactionStrategy.UserTransactionAdapter#begin()
will only executed once, but
EntityManager.joinTransaction()
needs to be called for every EntityManager.beforeProceed in class org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategyinvocationContext - current invocation-contextentityManagerEntry - entry of the current entity-managertransaction - current JTA transaction wrapped in an EntityTransaction adapterprotected UserTransaction resolveUserTransaction()
Copyright © 2013–2015 Osgiliath. All rights reserved.