Skip Headers

Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g Release 3 (10.1.3) B14428-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Configuring Exclusive Write Access to the Database

The `exclusive-write-access` attribute of the `<entity-deployment>` element states that this is the only bean that accesses its table in the database and that no external methods are used to update the resource. It informs the OC4J instance that any cache maintained for this bean will only be dirtied by this bean. Essentially, if you set this attribute to true, you are assuring the container that this is the only bean that will update the tables used within this bean. Thus, any cache maintained for the bean does not need to constantly update from the back-end database.

This flag does not prevent you from updating the table; that is, it does not actually lock the table. However, if you update the table from another bean or manually, the results are not automatically updated within this bean.

The default for this attribute is false. Because of the effects of the entity bean concurrency modes, this element is only allowed to be set to true for a `read-only` entity bean. OC4J will always reset this attribute to false for `pessimistic` and `optimistic` concurrency modes.

For more information, see "How do You Avoid Database Resource Contention?".

## Using Deployment XML

Example 14-12 shows the `orion-ejb-jar.xml` file element `entity-deployment` attribute `exclusive-write-access` configured to enable exclusive write access.

Example 14-12 orion-ejb-jar.xml for EJB 2.1 CMP Entity Bean Exclusive Write Access

    <entity-deployment ...  exclusive-write-access="true"
     ...
    </entity-deployment>