Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Remove method in entity bean  RSS feed

 
Anna Madhusudhanan Natanagopalan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi In SessionBean If we call remove( ) method , then the bean is destroyed. There is no problem. But in case of entity i created a row in the Database, now i want to (logoff) relieve the bean. i can not call the remove method in the eneity bean. if don't call then the bean instance for the particular user will be exists in the container. How long the instatnce will be exists in the container.
thanks and regards
Anna Madhusudhanan
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the end of a business method, the Container will passivate the bean. If there are too many beans in the pool, the Container can invoke the unsetEntityContext() method on a bean and then remove the instance (which then becomes available for garbage collection).
So, you don't do anything to remove bean types (stateless session, entity and message-driven) which are pooled. It's only stateful session beans which should be removed the moment that they are not needed.
 
himanshu airon
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>But in case of entity i created a row in the Database, now i want to (logoff) relieve the bean. i can not call the remove method in the eneity bean. if don't call then the bean instance for the particular user will be exists in the container.

Remember you are working directly on Entity Bean, It does not manage session for you. The Bean instance which you created by calling create() has created a row in the database. Your bean instance is mapped to this row and hence provide a view to this row.
>How long the instatnce will be exists in the container.
So as soon as it is dereferenced the container has the internal policy to Garbage Collect it or simply remove all data and send it to pool like stateless session bean.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!