How can you handle transaction isolation?

The EJB specification indicates that the API for controlling transaction isolation level is specific to the resource manager implementation, and therefore the architecture does not define and isolation level control API.

If a container uses only one bean instance per primary key, the container will synchronize access to the bean and therefore transaction isolation is unnecessary. Containers that use multiple instances per primary key depend on the underlying database for isolation.

Enterprise beans using container-managed persistence use the default isolation level of the underlying database; therefore, the isolation level cannot be modified. Entity beans using bean-managed persistence may use the underlying DBMS API to change the isolation level (using, for example, Connection.setTransactionIsolation().)

Additionally,a great portion of an application consists of simply fetching data from a DB. It is recommended to use 'Supported' for the transaction attribute of read-only operations. In such cases thee will be no transaction overhead if read only are the only operations in your transaction, but will be transactional if there are updates involved in the transaction.

0 comments :

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2018. Reads: best tracker