Access intent and isolation levels
The access intent service enables developers to precisely tune the management of application persistence.
Access intent enables developers to configure applications so that the EJB container and its agents can make performance optimizations for entity bean access. Entity beans and entity bean methods are configured with access intent policies. A policy is acted upon by either the combination of the WebSphere EJB container and Persistence Manager (for container-managed persistence (CMP) entities) or by bean-managed persistence (BMP) entities directly. Note that access intent policies apply to entity beans only.
Predefined access intent policies
Seven predefined access intent policies are available. The policies are composed of different attributes. You can directly configure most of these attributes only with WebSphere Application Server Enterprise. The access type is of primary interest and controls the isolation level, lock type, and duration of locks obtained when bean data is read from the database.
A pessimistic access type indicates to hold locks for the duration of the transaction under which the data loads. An optimistic type indicates to drop locks immediately after the data is read from the backend. A read type indicates that the run time must not allow updates to the data; any attempt to do so on data read under a read type results in an exception. Update types permit you to change data. The seven policies and their attribute definitions follow:
Policy Access type Collection scope Collection increment Resource manager prefetch increment Read ahead hint Exclusive No collision Promote wsPessimisticUpdate Pessimistic update Transaction 1 0 null wsOptimisticUpdate Optimistic update Transaction 25 0 null wsOptimisticRead Optimistic read Transaction 25 0 null wsPessimisticRead Pessimistic read Transaction 25 0 null wsPessimisticUpdate-Exclusive Pessimistic update Transaction 1 0 null true wsPessimisticUpdate-NoCollision Pessimistic update Transaction 25 0 null true wsPessimisticUpdateWeakestLockAtLoad Pessimistic update Transaction 25 0 null true
Note that to support connection sharing, ensure that all data loaded in the same transaction is under the same isolation level. Verify that all participating methods that drive loads are configured with either a pessimistic access type or an optimistic access type.
Related concepts
EJB deployment tool