• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Remove method in entity bean

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic