• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Entitiy bean, and record locking

 
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi:
I have a question about how the ejb lock a record for a user.
In HF EJB page 301, I understood that when a client call on a bean, the container lock the record in the DB, so that no one else can access it except the EJB container.
My question is, is that record locked for the client who asked for the record bean? if so, then no other clients can even view the record.
What will happen if few client are searching the DB. Are these records going to be locked to individual clients?!!
It doesn't make sense to me, and I appreciate any explination on how the locking actually works, and how can different clients search, view and update the records at the same time.
Thanks
[ July 22, 2004: Message edited by: Hanna Habashy ]
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just recently we learnt that the Container only *asks* the db for locking. If the database driver doesn't support record locking, this doesn't happen. This was the case of Oracle9i and the driver we were running at our office (the good news are that Oracle is smart enough to manage by itself concurrency and that a new driver that supports record locking is coming out).

In any case, there are many kinds of locking. Exclusive locking, non-exclusive locking. In few words, the container will ask for a record to be locked for updating operation (as this would preserve the state that in the meantime, through ejbLoad, the Container will have assigned to the entity). If a record cannot be written, no matter how many clients will access it, the state of the bean will remain in synch with the db, thus the 'Container main job' for CMP has been fulfilled.

Marco
 
Pay attention! Tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic