EJB and Transaction Isolation


EJB design: EJB and Transaction Isolation

  1. EJB and Transaction Isolation (2 messages)

    A significant portion of an application consists of simply fetching data from a db. When using EJBs for this, is it OK to run those finder methods with "NotSupported" transaction level? Will this improve performance and yet be safe?


    Threaded Messages (2)

  2. EJB and Transaction Isolation[ Go to top ]

    I usually recommended "Supported" for the transaction attribute of read-only operations. That way, your read-only operations won't have any transaction overhead if they are the only operations in your transaction, but will be transactional if there are updates involved in the transaction.
  3. EJB and Transaction Isolation[ Go to top ]

    The only thing I would caution you is "Not Supported" could lead to deadlocks if your transaction boundaries are not very well defined. For example, if there is an update of a record happening inside a transaction, (which is not committed), and then your method is called which will suspend that transaction, and if for any reason, your method tries to read the same record, which was updated but not committed earlier, you could be in a deadlock. So make sure your transaction boundaries are defined correctly, both within and across use cases.