Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

question about EJB Object and EJB instance?

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a little bit confusing about how EJB Object and EJB instance works on BEA Weblogic8.1.

for Stateless Session Bean, the create() method in home interface would return an EJB Object to the user. So, I assume here that each EJB Object for a Stateless Session Bean is associated with a user, is it correct?

but for Entity Bean, the Finder method in Home interface, would return a primary key or a collection of primary keys, which are then used to construct EJB Objects. So, each EJB Object for an Entity Bean is associated with a primary key. When two users try to access the same Entity Bean simultaneously, both of them would be coupled with the same EJB Object, and this EJB Object would be assocaited with two Bean Instances representing the same data, servicing those two users respectively. Is it right?
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

for Stateless Session Bean, the create() method in home interface would return an EJB Object to the user. So, I assume here that each EJB Object for a Stateless Session Bean is associated with a user, is it correct?


No. The client gets a stub to the EJBObject, which will typically exist before a user even logs in.

but for Entity Bean, the Finder method in Home interface, would return a primary key or a collection of primary keys, which are then used to construct EJB Objects. So, each EJB Object for an Entity Bean is associated with a primary key. When two users try to access the same Entity Bean simultaneously, both of them would be coupled with the same EJB Object, and this EJB Object would be assocaited with two Bean Instances representing the same data, servicing those two users respectively. Is it right?


This is a little tricky. Conceptually, an entity bean represents a particular entity in the DB, so there will be just one for the two users. But how many bean instances will there be at runtime? That's up to the container to decide. There could be one if the container were to serialize the user requests, two if the requests were multithreaded.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic