Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

EJBObject management

 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are EJBObjects for the various beans managed by the container?
1. Stateless session beans :
Is an EJB Object created everytime a home interface's create method is called? and Is the same EJB Object destroyed when the client calls remote interface remove() method?...Can EJBObjects be shared by clients at different times?
2. Message Driven beans:
Same questions as above.
3. Entity beans:
Same questions as above. But if the client never calls remove() method(say, he does not want the data to be deleted from the database), when does the associated EJBObject get destroyed?
4. Stateful session beans :
Let me guess. There could be a new EJBObject created and destroyed whenever client calls home interface remove() method and remote interface's remove() method. But the EJBObject still remains attached to the client, even when the bean instance has been passivated?
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Stateless session beans :
Is an EJB Object created everytime a home interface's create method is called? and Is the same EJB Object destroyed when the client calls remote interface remove() method?...Can EJBObjects be shared by clients at different times?
In case of stateless session bean creation and removal of bean's is detached from clients create() and remove() call.Container keeps pool of beans and takes a bean out of pool only to serve a business method.
So when client calls create() a EJBObject is created and client gets stub for that EJBObject.But container attaches a bean to EJBObject only when client calls a business method.
2. Message Driven beans:
Same questions as above.
Message driven beans do not have client view so they dont have EJBObject.
3. Entity beans:
Same questions as above. But if the client never calls remove() method(say, he does not want the data to be deleted from the database), when does the associated EJBObject get destroyed?
I am confused about this. In HFEJB on some pages author says that if more than one clients are trying to access same Entity then they will share EJBObject and on other pages i can see different EJBObjects sharing same entity bean. But i guess EJBObject can not be shared.
4. Stateful session beans :
Let me guess. There could be a new EJBObject created and destroyed whenever client calls home interface remove() method and remote interface's remove() method. But the EJBObject still remains attached to the client, even when the bean instance has been passivated?
EJBObject and bean is created and removed when client calls create() and remove().
EJBObject is not passivated because what will happen if client calls business method on passivated bean.EJBObject will be there and it will tell container to activate bean.
Sunil
    Bookmark Topic Watch Topic
  • New Topic