wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes unsetEntityContext and no unsetSessionContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "unsetEntityContext and no unsetSessionContext" Watch "unsetEntityContext and no unsetSessionContext" New topic
Author

unsetEntityContext and no unsetSessionContext

Hari babu
Ranch Hand

Joined: Jun 25, 2001
Posts: 208
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

Joined: May 12, 2003
Posts: 14
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

Joined: May 30, 2002
Posts: 6
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

Joined: Aug 07, 2001
Posts: 418
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unsetEntityContext and no unsetSessionContext
 
Similar Threads
why no unSetSessionContext?
UnsetSessionContext & UnsetMessageDrivenContext
unsetSessionContext
Entity Bean
Why session beans doesn't have unsetSessionContext()