Configure read-read consistency checking with the assembly tools
Overview
Read-read consistency checking only applies to LifeTimeInCache beans whose data is read from another transaction. For the Access Intents that are for repeatable read (RR), this means the product checks that the data is consistent with that in the data store, and ensures that no one updates it after the checking. For the Access Intents that are for read committed (RC), this means the product checks that the data is consistent at the point of checking, it does not guarantee that the data does not change after the checking. This makes the behavior of the LifeTimeInCache bean the same as non-LifeTimeInCache beans.
To perform this checking, we need to configure CMP entity beans with read-read consistency checking. We can do this using the Application Server Toolkit.
Procedure
- Start the Application Server Toolkit.
- In the Project Explorer view of the J2EE perspective, right-click the Deployment Descriptor: EJB Module Name under the EJB module for the bean instance, then select Open With > Deployment Descriptor Editor. A property dialog notebook for the EJB project is displayed in the property pane.
- Select the Access tab. The Add Access Intent window appears. There are two areas of the panel that deal with adding access intent:
- Default Access Intent for Entities 2.x (Bean Level)
- Access Intent for Entities 2.x (Method Level)
- Select the Bean or Method level. Another access intent window appears where one can set the properties you wish to use.
- Use the dropdown list to select the Access intent name.
- Optional: Enter a description.
- Check the Persistence Option box.
- Check the Verify Read Only Data box.
- Use the dropdown 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.
- Select Finish.
See also
Examples: read-read consistency checking