@Dependent public class TransactionalInterceptorStrategy extends Object implements PersistenceStrategy
Default implementation of our pluggable PersistenceStrategy. 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 PersistenceStrategy, then use the standard CDI @Alternative mechanism.
Constructor and Description |
---|
TransactionalInterceptorStrategy() |
Modifier and Type | Method and Description |
---|---|
Object |
execute(javax.interceptor.InvocationContext invocationContext) |
protected Transactional |
extractTransactionalAnnotation(javax.interceptor.InvocationContext context) |
protected Class<? extends Annotation> |
getTransactionQualifier(Transactional transactionalAnnotation) |
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 InterceptorStrategy
Exception
protected Exception prepareException(Exception e)
e
- protected Transactional extractTransactionalAnnotation(javax.interceptor.InvocationContext context)
protected Class<? extends Annotation> getTransactionQualifier(Transactional transactionalAnnotation)
protected javax.enterprise.inject.spi.Bean<javax.persistence.EntityManager> resolveEntityManagerBean(Class<? extends Annotation> qualifierClass)
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.