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.