Isolation levels in EJB

Discussions

EJB design: Isolation levels in EJB

  1. Isolation levels in EJB (3 messages)

    When we r using transactions in EJB.We can use 4 different isolation levels.

    TRANSACTION_READ_UNCOMMITED
    TRANSACTION_READ_COMMITED
    TRANSACTION_REPEATABLE_READ
    TRANSACTION_READ_SERIALIZABLE.

    can any one explain in which scenario each of these levels r used.


    Thanks
    Mushtaq

    Threaded Messages (3)

  2. Choosing a right isolation level[ Go to top ]

    Choosing a right isolation level for your program depends upon your application's requirement. In a single application itself the requirement generally changes, suppose if you write a program for searching a product catalog from your database then you can choose TRANSACTION_READ_ UNCOMMITED because you need not worry about the isolation problems , some other program can insert records at the same time, you don't have to bother much about that insertion. Obviously this improves performance significantly.

    If you write a critical program like bank or stocks analysis program where you want to control all of the isolation problems, you can choose TRANSACTION_SERIALIZABLE for maximum safety. Here it is the tradeoff between the safety and performance.

    Other two isolation levels need good understanding of your requirement. If your application needs only committed records, then TRANSACTION_READ_COMMITED isolation is the good choice. If your application needs to read a row exclusively till you finish your work, then TRANSACTION_REPEATABLE_READ is the best choice.
  3. Choosing a right isolation level[ Go to top ]

    Thanks Madhavi
  4. Isolation[ Go to top ]

    TRANSACTION_READ_COMMITED in case of Dirty Read
    TRANSACTION_REPEATABLE_READ in case of Unrepeatable
    TRANSACTION_READ_SERIALIZABLE in case of Phantom read