|
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 3 (10.1.3) B14428-01 |
|
![]() Previous |
![]() Next |
You can configure a BMP entity bean as read-only. By doing so, you enter into a contract with OC4J by which you guarantee not to change the BMP entity bean's state after it is activated. Unlike CMP read-only, no exception will be thrown if you do update a read-only BMP bean.
When you configure a BMP entity bean as read-only, OC4J uses a special case of commit option A (see "Configuring BMP Commit Options") to improve performance by:
Caching the instance
Not calling ejbLoad after activation
Not updating the instance or calling ejbStore when the transaction commits
As Figure 15-1 shows, multiple clients accessing the same read-only BMP entity bean by primary key are allocated a single instance. Both Client 1 and Client 2 are satisfied by the same cached read-only BMP entity bean instance. Because the BMP entity bean 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 lifecycle methods.
Figure 15-1 Read-Only BMP Entity Beans and Commit Option A
Example 15-1 shows the orion-ejb-jar.xml file entity-deployment element locking-mode attribute mode configured to specify a BMP entity bean as read-only.