Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unsetEntityContext and no unsetSessionContext

 
Hari babu
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Why is that we have an unsetEntityContext() method in entity bean but there is no method called unsetSessionContext() in session bean. What is the rationale behined this ?
Hari
 
Naidu Jitta
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
ejbRemove() is called for session beans every time the container destroyes the bean. So you can use this method to do the stuff you typically would do in unsetEntityContext().
For entity beans ejbRemove() is only called if the user explicitly deletes the bean. I think that is the reason why the engineers at SUN invented the unsetEntityContext() for this kind of bean.
 
yik yang
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, then can i know how to manually call unsetEntityContext? I dont want to call ejbRemove but my ejbRemove will delete the actual data in database.
What i want is to manually destroy the entity object in memory. So can i call unsetEntityContext? And how to call it?
 
Rashmi Tambe
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unsetEntityContext is a container callback method. So u can not explicitly call it. the container calls it when the bean instance is to be destoyed from the memory. It does not mean that the bean is deleted from database. Container only dis-associates the bean instance and destroys the instance.
Correct me if i am wrong.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic