Access intent for EJB 2.x entities is the replacement in the EJB
2.x specification for the EJB 1.x access intents and EJB 1.x isolation levels.
There are two general methods for adding access intent to enterprise
beans 2.x:
- Default access intent (bean level): this default method for handling
access intent based on the bean level should be used in most cases.
- Method-level access intent: this advanced method for handling access
intent based on methods should only be used in advanced situations.
To add default access intent (bean level) to an enterprise bean
2.x:
- Switch to the J2EE perspective.
- In the Project Explorer view, click EJB Projects > project > ejbModule > META-INF > ejb-jar.xml. The EJB Deployment Descriptor window opens.
- On the Access page of the editor. select
one or more beans, under the Default Access Intent for Entities
2.x (Bean Level) section, click the Add button.
The Add Access Intent wizard opens.
- In the Access intent name field, select
an access intent type from the drop-down list.
- Optional: Type a description for the new access intent.
- To set the persistence, select the Persistence Option check
box. You have three persistence options:
- If you select the Verify Read Only Data check box,
use the drop-down list to select your choice for read-read consistency checking.
You have three options:
- NONE No read-read checking is done.
- AT_TRAN_BEGIN During ejbLoad, if the data is from cache, check
the database to ensure that the data of the bean has not changed since the
last load (with proper locking based on access intent's concurrency control
attribute).
- AT_TRAN_END At the end of transaction, if the bean is not changed
and did not load by the current transaction, check the database to ensure
that the data of the bean has not changed from last load (with proper locking
based on access intent's concurrency control attribute). If the data has changed,
fail the transaction.
For examples on read-read consistency checking, see Examples: read-read consistency checking.
- If you select the Partial Operation check box, use the drop-down
list to select your choice for partial operation. You have two options:
- NONE This is the default setting, where all the persistent attributes
of the CMP bean to the database are stored to the database, even though a
subset of the persistent attributes fields might have been changed.
- UPDATE_ONLY Limit updates to the database to only persistent attributes
of the CMP bean that have been modified.
For more details on partial operation, see Partial operation for container managed persistence.
- If you select the Deferred Operation check box, use the drop-down
list to select your choice for deferred operation. You have three options:
- NONE Nothing is deferred.
- CREATE_ONLY Only ejbCreate commands are deferred until the next
ejbStore occurs to create row in database.
- ALL All ejbCreate, ejbStore, and ejbRemove commands are deferred
until a flush is needed, which is either before a finder method or before
transaction completion.
For more information on deferred operation, see Deferred create for container managed persistence.
- The batch operation uses the JDBC batch command to insert, update,
or delete rows in the database backend that this particular enterprise bean
is connected to. For more information on the batch operation, see Batch commands for container managed persistence .
To select the batch operation:
- In the Deferred Operation, select ALL .
(You must select All to use the batch option.)
- Check the Batch box.
- Click Finish.
The access intent is added. To remove the access intent, select it
and click the Remove button.