EJB programming & troubleshooting: Transactions(LONG)

  1. Transactions(LONG) (3 messages)

    Look at this paragraph from Mastering EJB:
    "When you cal an entity bean in a transaction,the first action that happen is bean needs to load database datathrough the ejbLoad() method, which acquires locks in the database and ensures the entity bean cache is consistent.then one or more business methods are called, when the transaction is commited,the entity bean's ejbStore() method is called, which writes all updates to the database and release the locks."

    I want to know what does the lock mean here? does it mean that through a method call in entity bean that row is locked and no-one else can do anything with that row ?


    Threaded Messages (3)

  2. Transactions(LONG)[ Go to top ]

    The lock being refered to is a logical lock and not something physical at the DB layer ( Row level locking).

    There are essentially a couple of locking strategies from a component perspective, Optimistic and Passimistic locks. These are enforced at a Business Logic level either in through BMP or the underlying CMP implementation.

    Look up EJB Design patters relative to DAO's for more information.
  3. Transactions(LONG)[ Go to top ]

    What happens depends very much on what Application Server you use and the concurrency level you have set up.

    BEA Weblogic default from 6.1 onward is to rely on the database to provide the locking,

  4. Transactions(LONG)[ Go to top ]

    While an entitybean is participating in a transaction, it gains a lock to that particular row and no one else can manipulate that row until transaction reaches to a consistent state.

    However, the way locks are created and released varies based on the container and the database itself.

    Even the transaction isolation level plays an important role.

    Not all databases support all types of isolation levels.
    Please refer to transactions doc for details about the above isolation levels.