org.apache.myfaces.extensions.cdi.jpa.impl
Class LegacyTransactionalInterceptorStrategy

java.lang.Object
  extended by org.apache.myfaces.extensions.cdi.jpa.impl.LegacyTransactionalInterceptorStrategy
All Implemented Interfaces:
Serializable, InterceptorStrategy, PersistenceStrategy

@Dependent
@Alternative
public class LegacyTransactionalInterceptorStrategy
extends Object
implements PersistenceStrategy

Attention! although this impl is called 'Default...' it is not used anymore! If you still like to use it, then enable it as Alternative in your bean.xml!

Old 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.

See Also:
Serialized Form

Constructor Summary
LegacyTransactionalInterceptorStrategy()
           
 
Method Summary
protected  void beginTransaction(javax.persistence.EntityManager entityManager)
           
protected  void commitTransaction(javax.persistence.EntityManager entityManager)
           
protected  void endProcess(org.apache.myfaces.extensions.cdi.jpa.impl.EntityManagerEntry entityManagerEntry, javax.persistence.EntityManager entityManager, Exception exception)
           
 Object execute(javax.interceptor.InvocationContext context)
          
protected  Transactional extractTransactionalAnnotation(javax.interceptor.InvocationContext context)
           
protected  Class<? extends Annotation> getTransactionQualifier(Transactional transactionalAnnotation)
           
protected  Object proceedMethodInTransaction(javax.interceptor.InvocationContext context, org.apache.myfaces.extensions.cdi.jpa.impl.EntityManagerEntry entityManagerEntry, javax.persistence.EntityManager entityManager, javax.persistence.EntityTransaction transaction)
           
protected  javax.enterprise.inject.spi.Bean<javax.persistence.EntityManager> resolveEntityManagerBean(Class<? extends Annotation> qualifierClass)
           
protected  void rollbackTransaction(javax.persistence.EntityManager entityManager)
           
protected  Object startProcess(javax.interceptor.InvocationContext context, org.apache.myfaces.extensions.cdi.jpa.impl.EntityManagerEntry entityManagerEntry, javax.persistence.EntityManager entityManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LegacyTransactionalInterceptorStrategy

public LegacyTransactionalInterceptorStrategy()
Method Detail

execute

public Object execute(javax.interceptor.InvocationContext context)
               throws Exception

Specified by:
execute in interface InterceptorStrategy
Throws:
Exception

extractTransactionalAnnotation

protected Transactional extractTransactionalAnnotation(javax.interceptor.InvocationContext context)

getTransactionQualifier

protected Class<? extends Annotation> getTransactionQualifier(Transactional transactionalAnnotation)

resolveEntityManagerBean

protected javax.enterprise.inject.spi.Bean<javax.persistence.EntityManager> resolveEntityManagerBean(Class<? extends Annotation> qualifierClass)

startProcess

protected Object startProcess(javax.interceptor.InvocationContext context,
                              org.apache.myfaces.extensions.cdi.jpa.impl.EntityManagerEntry entityManagerEntry,
                              javax.persistence.EntityManager entityManager)
                       throws Exception
Throws:
Exception

proceedMethodInTransaction

protected Object proceedMethodInTransaction(javax.interceptor.InvocationContext context,
                                            org.apache.myfaces.extensions.cdi.jpa.impl.EntityManagerEntry entityManagerEntry,
                                            javax.persistence.EntityManager entityManager,
                                            javax.persistence.EntityTransaction transaction)
                                     throws Exception
Throws:
Exception

beginTransaction

protected void beginTransaction(javax.persistence.EntityManager entityManager)

commitTransaction

protected void commitTransaction(javax.persistence.EntityManager entityManager)

rollbackTransaction

protected void rollbackTransaction(javax.persistence.EntityManager entityManager)

endProcess

protected void endProcess(org.apache.myfaces.extensions.cdi.jpa.impl.EntityManagerEntry entityManagerEntry,
                          javax.persistence.EntityManager entityManager,
                          Exception exception)
                   throws Exception
Throws:
Exception


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.