JPA パーシスタンス・ユニットでの TaskName の指定

Java™ Persistence API (JPA) パーシスタンス・ユニットで TaskName を指定します。

このタスクについて

TaskName は、パーシスタンス・ユニットの wsjpa.AccessIntent プロパティー名を使用して persistence.xml ファイル内に定義されます。プロパティー値は、TaskNames、エンティティー・タイプ、およびアクセス・インテント定義のリストです。 以下の例は、パーシスタンス・ユニットにある wsjpa.AccessIntent プロパティー名のコンテンツを示します。
< property name  = "wsjpa.AccessIntent"
         value = "Tasks=' <taskName> { <entityName> ( <isolationLockValue> ) } ' "/>
                         A            A              A                    | | |
                         |            |              +--------- , --------+ | |
                         |            +----------------- , -----------------+ |
                         +----------------------- , --------------------------+
  Tasks                        ::= <task> [ ',' <task> ]*
     
  <task>                       ::= <taskName> '{' <entity> [ ',' <entity> ]* '}'
     
  <entity>                     ::= <entityName> '(' <isolationLockValues> ')'
     
  <taskName>                   ::= <fully_qualified_identifier>
     
  <entityName>                 ::= <fully_qualified_identifier>
     
  <fully_qualified_identifier> ::= <identifier> [ '.' <identifier> ]*
     
  <identifier>                 ::= <idStartCharacter> [ <idCharacter> ]*
     
  <idStartCharacter>           ::= Character.isJavaIdentifierStart | '?' | '*'
     
  <idStartCharacter>           ::= Character.isJavaIdentifierPart  | '?' | '*'
     
  <isolationLockValues>        ::= <isolationLockValue> [ ',' <isolationLockValue> ]
    
  <isolationLockValue>         ::= <isolation> | <readLock>
     
  <isolation>                  ::= "isolation" '=' <isolationValue>
     
  <readLock>                   ::= "readlock" '=' <readlockValue>
 
  <isolationValue>             ::= "read-uncommitted"|"read-committed"|"repeatable-read"|"serializable"
     
  <readlockValue>              ::= "read" | "write"
パーシスタンス・ユニットに TaskName を設定する前に、以下のことに注意してください。
  • トークン間の空白は無視されます。
  • <isolation> および <readLock> コンテンツ以外は大/小文字を区別します。
  • <TaskName> は、com.acme.bean.MyBean.increment などの完全パッケージ修飾メソッド名のフォームか、または MyProfile などの任意のユーザー定義のタスク名です。
  • <entityName> は、com.acme.bean.Entity1 などの完全パッケージ修飾クラス名のフォームです。
  • ワイルドカード文字は「?」または「*」を <TaskName> および <entityName> で使用できます。 "?" は任意の単一の文字を表し、「*」は 0 個以上の一連の文字列を表します。
  • タスク定義では hintNames 分離および readLock が使用でき、その順番は関係ありません。
  • readLock の値が write の場合は、分離は repeatable-read または serializable にする必要があります。
  • readLock の値が read の場合は、分離が read-uncommitted であれば無効になります。
以下のコード例は、JPA パーシスタンス・ユニットでの TaskName の指定方法を示します。
package my.company;

@Remote
class Ejb1 {
    // assumer no tx from the caller
    @TransactionAttribute(Requires)
    public void caller_Method1() {

        // an implicit new transaction begins
        // TaskName "my.company.Ejb1.caller_Method1" set on TSR

        ejb1.callee_Method?();
    }

    @TransactionAttribute(RequiredNew)
    public void callee_Method2() {

        // an implicit new transaction begins i.e. TxRequiredNew.
        // TaskName "my.company.Ejb1.callee_Method2" set on TSR
    }

    @TransactionAttribute(Requires)
    public void callee_Method3() {

        // In caller's transaction, hence TaskName remains 
        //     "my.company.Ejb1.caller_Method1"
    }

    @TransactionAttribute(NotSupported)
    public void callee_LocalTx () {

        // Unspecified transaction, a new local transaction implicitly started.
        // TaskName "my.company.Ejb1.callee_LocalTx" set on TSR
    }

}
TaskName とエンティティー・タイプの指定にはワイルドカードを使用できるため、実行時に複数の指定が一致する場合があります。タスク名とエンティティー・タイプの検索は、wsjpa.AccessIntent プロパティーで定義した順序で行われます。
<properties>
  <property name="wsjpa.AccessIntent" value="Tasks="
        *.Task1 { *.Employee1 ( isolation=read-uncommitted                 ),
                  *.Employee?
( isolation=repeatable-read,  readlock=write ),
                },
        *       { *.Employee3 ( isolation=serializable,     readlock=write ) },
      '" />
</properties>

トピックのタイプを示すアイコン タスク・トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tejb_specTaskNamepu
ファイル名:tejb_specTaskNamepu.html