Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (10.1.3.5.0)

Part Number E13981-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Configuring a Read-Only Entity Bean With Bean-Managed Persistence

You can configure an entity bean with container-managed persistence as read-only. By doing so, you enter into a contract with OC4J, by which you guarantee not to change the state of the entity bean with container-managed persistence after it is activated. Unlike read-only entity beans with container-managed persistence, no exception will be thrown if you do update a read-only bean with bean-managed persistence.

When you configure an entity bean with bean-managed persistence as read-only, OC4J uses a special case of commit option A (see "Configuring Commit Options for an Entity Bean With Bean-Managed Persistence") to improve performance by the following:

As Figure 15-1 shows, multiple clients accessing the same read-only entity bean with bean-managed persistence by primary key are allocated a single instance. Both Client 1 and Client 2 are satisfied by the same cached instance of a read-only entity bean with bean-managed persistence. Because the entity bean with bean-managed persistence is read-only, both transactions can proceed in parallel.

Without this optimization, each client is allocated a separate instance, and each instance requires the execution of all life cycle methods.

Figure 15-1 Read-Only Entity Beans With Bean-Managed Persistence and Commit Option A

Description of Figure 15-1 follows
Description of "Figure 15-1 Read-Only Entity Beans With Bean-Managed Persistence and Commit Option A"

Using Deployment XML

Example 15-4 shows the orion-ejb-jar.xml file entity-deployment element locking-mode attribute mode configured to specify an entity bean with bean-managed persistence as read-only.

Example 15-4 orion-ejb-jar.xml For Read-Only

<entity-deployment
    name=EmployeeBean"
    location="bmpapp/EmployeeBean" 
    locking-mode="read-only"
>
...
</entity-deployment>