Skip Headers
Oracle® Containers for J2EE Orion CMP Developer's Guide
10g Release 3 (10.1.3)
B19177-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Configuring Database Isolation Levels

You can configure one of the database isolation levels (see "Entity Bean Database Isolation Levels and Resource Contention") for a specific bean. That is, you can specify that when the bean starts a transaction, the database isolation level for this bean be what is specified in the OC4J-specific deployment descriptor (on parallel execution or data consistency).


Note:

Once set, the isolation level for the bean is valid for the entire transaction.

You can set the isolation level for each entity bean in the isolation attribute of the <entity-deployment> element (see Table A-1, "Attributes of the <entity-deployment> Element"). You can use committed or serializable value with committed being the default. To change this default value to serializable, configure the following in the orion-ejb-jar.xml for the intended bean:

<entity-deployment ...  isolation="serializable"
 ...
</entity-deployment>

The serializable isolation level provides data consistency; the committed isolation level enables the parallel execution.


WARNING:

Do not set the isolation level to serializable if you are using a nonemulated data source. If you do use this setting, the nonemulated data source will not work.



WARNING:

There is a danger of lost updates with the serializable level if the <max-tx-retries> element value in the OC4J-specific deployment descriptor is greater than 0 (with 0 being the default). If this element is set to greater than 0, then the container retries the update if a second blocked client receives an ORA-8177 exception. The retry would find the row unlocked and the update would occur. Thus, the second client's update succeeds and overwrites the first client's update. If you use serializable isolation level, consider leaving the <max-tx-retries> element as 0 for data consistency.


If you do not define an isolation level, you receive the level that is configured in the database. Setting the isolation level within the OC4J-specific deployment descriptor temporarily overrides the database configured isolation level for the life of the global transaction for this bean. That is, if you define the bean to use the serializable level, then OC4J will force the database to be serializable for this bean only until the end of the transaction.

You can specify both the entity bean concurrency mode and database isolation level, if the combination affects the outcome of your resource contention. See "Combining Entity Bean Database Isolation Level and Concurrency Mode" for more information.

For more information about resource contention, see "Avoiding Database Resource Contention".