wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Concurrency in entity bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Concurrency in entity bean" Watch "Concurrency in entity bean" New topic
Author

Concurrency in entity bean

Raj Neets
Ranch Hand

Joined: Nov 12, 2002
Posts: 46
I have just started with EJB, I have doubt regarding how a container implements concurrency when it comes to Entity bean.
Book(EJB by Richard) says that in entity bean instance can't be accessed concurrently though the EJBObject is shared by more than one client.My doubt is
If there is pool of instance (of beans) and two EJBObject associated with two different clients, both access the EJBObject at the same. Then instance associated with two EJBObject will be different ones.But the data in database represented by the EJBObject(or bean instance) will be same.When one Client changes the data and the other overrides the change, there is a chance at some point the data represented by the instances may be different.
Can some one please explain to me how a container takes care of this concurrency problem.

Thank you
Raj
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Database level locking solves the problem. All the container does is use the appropriate database commands (like SELECT..FOR UPDATE) to lock the rows appropriately.
Every container is different. For an explanation of how WebSphere solves this problem, take a look at this article..
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Concurrency in entity bean