@Dependent public class ResourceLocalTransactionStrategy extends Object implements org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy
Default implementation of our plugable TransactionStrategy. It supports nested Transactions with the MANDATORY behaviour.
The outermost @Transactional interceptor for the given
Qualifier will open an EntityTransaction
and the outermost @Transactional interceptor for all
EntityManagers will flush and subsequently close all open transactions.
If an Exception occurs in flushing the EntityManagers or any other Exception gets thrown inside the intercepted method chain and not gets catched until the outermost @Transactional interceptor gets reached, then all open transactions will get rollbacked.
If you like to implement your own TransactionStrategy, then use the standard CDI @Alternative mechanism.
| Constructor and Description |
|---|
ResourceLocalTransactionStrategy() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
beforeProceed(EntityManagerEntry entityManagerEntry) |
protected EntityManagerEntry |
createEntityManagerEntry(javax.persistence.EntityManager entityManager,
Class<? extends Annotation> qualifier) |
Object |
execute(javax.interceptor.InvocationContext invocationContext) |
protected javax.persistence.EntityTransaction |
getTransaction(EntityManagerEntry entityManagerEntry) |
protected void |
onCloseTransactionScope() |
protected Exception |
prepareException(Exception e)
This method might get overridden in subclasses to supply better error messages.
|
protected javax.enterprise.inject.spi.Bean<javax.persistence.EntityManager> |
resolveEntityManagerBean(Class<? extends Annotation> qualifierClass) |
public Object execute(javax.interceptor.InvocationContext invocationContext) throws Exception
execute in interface org.apache.deltaspike.core.spi.InterceptorStrategyExceptionprotected EntityManagerEntry createEntityManagerEntry(javax.persistence.EntityManager entityManager, Class<? extends Annotation> qualifier)
protected javax.persistence.EntityTransaction getTransaction(EntityManagerEntry entityManagerEntry)
entityManagerEntry - entry of the current entity-managerEntityTransaction of the given EntityManager.
A subclass can also return an adapter e.g. for an UserTransactionprotected void beforeProceed(EntityManagerEntry entityManagerEntry)
protected Exception prepareException(Exception e)
protected void onCloseTransactionScope()
protected javax.enterprise.inject.spi.Bean<javax.persistence.EntityManager> resolveEntityManagerBean(Class<? extends Annotation> qualifierClass)
Copyright © 2011-2013 The Apache Software Foundation. All Rights Reserved.