• Post Reply Bookmark Topic Watch Topic
  • New Topic

Entity bean vs multiple client

 
Rajib Sarma
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
In a tutorial, I found that a session bean instance can be used by only 1 client at a time, but an entity bean instance can be used by more than 1 client at a time. I think the second part of the statement is wrong as EJB is based on RMI-IIOP. Please comment on the topic.
Thanks
-Rajib
 
Randy Coates
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Entity beans by their nature need to be accessible to more than one client at a time. The container is required to handle concurrency issues within entity beans. According to Monson-Haefel on page 63 of his book _Enterprise JavaBeans_,
"EJB has addressed the dangers associated with concurrency in entity beans by implementing a simple solution: EJB, by default, prohibits concurrent access to bean instances. In other words, several clients can be connected to one EJB object, but only one client thread can access the bean instance at a time. ... In fact, if [a] method is part of a larger transaction the bean instance cannot be accessed at all, except within the same transaction context, until the entire transaction is complete."
Does this answer your question?
Randy Coates
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!