org.guiceex.jpa.transaction
クラス TransactionInterceptor
java.lang.Object
org.guiceex.jpa.transaction.TransactionInterceptor
- すべての実装されたインタフェース:
- Advice, Interceptor, MethodInterceptor
public class TransactionInterceptor
- extends Object
- implements MethodInterceptor
メソッド呼び出しにインターセプトされるトランザクションサービスを提供します。
@Transactionalへ指定されているTransactionAttributeType
に応じたトランザクション処理を行ます。
また、@PersistenceContextを持つ
フィールドをサブクラスより検索し、最初に見つけたフィールドへ、EntityManagerを抽入します。
JPAの仕様では、継承階層に存在する全ての@PersistenceContext注釈フィールドに
抽入する事になってますが、Guiceexでは最下層の@PersistenceContextフィールドのみに抽入します。
その為、複数のpersistence-unitのEntityManagerインスタンスを、1つのEntityManagerクライアント
のインスタンスで扱う事はできません。
EntityManagerは、@PersistenceContext.unitName()で指定されたユニット用のインスタンスを、
必要に応じて@PersistenceContext.properties()を使用して作成し、直接フィールドに対して抽入します。
- 作成者:
- matu◆AliceLAklI
| クラス java.lang.Object から継承されたメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TransactionInterceptor
public TransactionInterceptor(TransactionAttributeType type)
invoke
public Object invoke(MethodInvocation invocation)
throws Throwable
- 定義:
- インタフェース
MethodInterceptor 内の invoke
- 例外:
Throwable
Copyright © 2007. All Rights Reserved.