Specifying a TaskName in Java Persistence API (JPA) persistence unit
<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"
Before setting the TaskName in a persistence unit, keep
the following in mind: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
}
}
<properties>
<property name="wsjpa.AccessIntent" value="Tasks="
*.Task1 { *.Employee1 ( isolation=read-uncommitted ),
*.Employee? ( isolation=repeatable-read, readlock=write ),
},
* { *.Employee3 ( isolation=serializable, readlock=write ) },
'" />
</properties>