org.eiichiro.gig.persistence
Class JPATransactionalInterceptor

java.lang.Object
  extended by org.eiichiro.gig.persistence.JPATransactionalInterceptor

@Transactional
@Interceptor
public class JPATransactionalInterceptor
extends Object

JPATransactionalInterceptor is a Gig interceptor component to intercept transactional method (@Transactional annotated component method) and to control the transaction commitment of JPA (Java Persistence API) EntityManager.

Author:
Eiichiro Uchiumi

Constructor Summary
JPATransactionalInterceptor()
           
 
Method Summary
 Object transact(org.eiichiro.reverb.reflection.Invocation<?> invocation)
          Controls JPA EntityManager's transaction commitment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPATransactionalInterceptor

public JPATransactionalInterceptor()
Method Detail

transact

@Around
public Object transact(org.eiichiro.reverb.reflection.Invocation<?> invocation)
                throws Throwable
Controls JPA EntityManager's transaction commitment. First, this method begins a transaction on EntityManager. If the transactional method invocation is succeeded, this method commits the transaction. If the transactional method throws any exception, this method rolls back the transaction and re-throws the exception.

Parameters:
invocation - The encoded method invocation of transactional method.
Returns:
The invocation result.
Throws:
Throwable - If transactional method throws any exception.


Copyright © 2012 Eiichiro Uchiumi. All Rights Reserved.