• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Some basic doubts on session beans...

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am having some basic doubts on session beans, please clarify them ( I know they are very silly for you)

1. What will happen if the user calls remove() method on stateless session bean ?

2. What will happen if the user is not calling any of the methods for long time, when the statefull session bean is in method ready state.
==> My understanding is - If the method is in the transaction and the user is not interacting for the specified time( defined by the container), then ejbRemove() method is called and the bean moves to 'does not exist' state.
If the method is not in the trasaction, first the bean is moved to passivate state and even after moving to the passivate state user is not calling any methods, then the bean is moved to 'does not exist' state, with out calling, ejbRemove() method -
Is this correct or not? If it is not, then please correct me

3. How can we get the transaction reference in ejbPassivate()/ejbActivate() methods -- Bec, ejbPassivate() is called only if the bean is not in the transaction. Now, if the bean is not in the transaction, how will you get the transaction references???

4. In setSeesingContext(), why can't i get the reference to the EJBObject()? Bec, EJB Object is created before creating the session context.

5. Will ejbRemove() is called, if user calles the remove() method and the bean is already passivated, i.e. bean is in passivated state.

Thanks..
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) The container ignores the remove request
2) The bean will NEVER be passivated or removed if it is in a transaction, no matter how long it has been since the client called a method. The container might call ejbRemove first, instead of calling ejbPassivate. You're right, if the bean is passivated, the container will not call ejbRemove.
 
Skool. Stay in. Smartness. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic