This is from the
ejb spec regarding isolation levels.
17.3.2 Isolation levels
Transactions not only make completion of a unit of work atomic, but they also isolate the units of work
from each other, provided that the system allows concurrent execution of multiple units of work.
Support for Transactions Enterprise JavaBeans 2.0, Final Release Bean Provider’s responsibilities
Sun Microsystems, Inc.
The isolation level describes the degree to which the access to a resource manager by a transaction is
isolated from the access to the resource manager by other concurrently executing transactions.
The following are guidelines for managing isolation levels in enterprise beans.
• The API for managing an isolation level is resource-manager specific. (Therefore, the EJB
architecture does not define an API for managing isolation level.)
• If an enterprise bean uses multiple resource managers, the Bean Provider may specify the same
or different isolation level for each resource manager. This means, for example, that if an enterprise
bean accesses multiple resource managers in a transaction, access to each resource manager
may be associated with a different isolation level.
• The Bean Provider must take care when setting an isolation level. Most resource managers
require that all accesses to the resource manager within a transaction are done with the same
isolation level. An attempt to change the isolation level in the middle of a transaction may
cause undesirable behavior, such as an implicit sync point (a commit of the changes done so
far).
• For session beans and message-driven beans with bean-managed transaction demarcation, the
Bean Provider can specify the desirable isolation level programmatically in the enterprise
bean’s methods, using the resource-manager specific API. For example, the Bean Provider can
use the java.sql.Connection.setTransactionIsolation(...) method to set
the appropriate isolation level for database access.
• For entity beans with container-managed persistence, transaction isolation is managed by the
data access classes that are generated by the container provider’s tools. The tools must ensure
that the management of the isolation levels performed by the data access classes will not result
in conflicting isolation level requests for a resource manager within a transaction.
• Additional care must be taken if multiple enterprise beans access the same resource manager in
the same transaction. Conflicts in the requested isolation levels must be avoided.
So it looks like though we can set the Isolation levels we need the database to support it.
[ May 13, 2002: Message edited by: Rahul Mahindrakar ]