This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJBObject management

 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • 0
  • 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?
 
Sunil Patil
Greenhorn
Posts: 15
  • 0
  • 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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic