org.clazzes.util.jpa.interceptors
Class EntityTransactionInterceptor

java.lang.Object
  extended by org.clazzes.util.jpa.interceptors.EntityTransactionInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

public class EntityTransactionInterceptor
extends java.lang.Object
implements org.aopalliance.intercept.MethodInterceptor

This interceptor spans a resource-local EntityTransaction inside a scope, where an entity manager has been opened using an EntityManagerInterceptor.

If the EntityManagerInterceptor is configured to join a JTA transaction, the use of this interceptor is discouraged, because transaction management is delegated


Constructor Summary
EntityTransactionInterceptor()
           
 
Method Summary
 java.lang.String getThreadLocalKey()
           
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
           
 void setThreadLocalKey(java.lang.String threadLocalKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityTransactionInterceptor

public EntityTransactionInterceptor()
Method Detail

invoke

public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
                        throws java.lang.Throwable
Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Throws:
java.lang.Throwable

getThreadLocalKey

public java.lang.String getThreadLocalKey()
Returns:
the threadLocalKey under which the EntityManager has been previously bound to the current thread using ThreadLocalManager.bindResource(String, Object).

setThreadLocalKey

public void setThreadLocalKey(java.lang.String threadLocalKey)
Parameters:
threadLocalKey - the threadLocalKey under which the EntityManager is bound to the current thread using ThreadLocalManager.bindResource(String, Object) to set.


Copyright © 2011. All Rights Reserved.