Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How a Statefull Session Bean is tied to the Client

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How a Statefull Session Bean is tied to a particular Client? Does the tieup depends on the parameter we pass in the ejbcreate() method or it is independent.How exactly the tie-up is build & when does it breaks.
1 more.
By looking at the code is it possible to distinguish between Stateful Session Bean & Stateless Session Bean. If so, then on what basis.
Thnxs.
 
Ranch Hand
Posts: 159
Eclipse IDE C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is in the deployment descriptor that you say if its a statefull or stateless session bean.
 
Saloon Keeper
Posts: 22285
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Store a handle to the stateful bean in your Session.
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How a Statefull Session Bean is tied to a particular Client?
Does the tieup depends on the parameter we pass in the ejbcreate() method or it is independent?

This is handled by the EJBHome/Object stub of your SFSB client and the EJB Container.We do not have to worry about that. The EJB Container manages it smartly.It maintains the session for us and does not dependent on any data that we pass in the methods.We only pass the state information specific to the client depending on our business logic.
How exactly the tie-up is build & when does it breaks?
- It breaks when home.remove() or remote.remove() is called by the client or a time-out for the SFSB occurs at the server side. SFSB bean instance serving this client is destroyed by the Container.

By looking at the code is it possible to distinguish between Stateful Session Bean & Stateless Session Bean. If so, then on what basis?

Yes it is possible if you understand the differences between SFSB and SLSB.
1. SLSB has only 1 ejbCreate() method in the bean, while SFSB can have overloaded ejbCreate() methods with different parameters.
2. There could be member variables in the bean class to hold client-specific state for SFSB
3. There could be some valid code in ejbActivate() and ejbPassivate() methods for SFSB.These methods do not make sense for SLSB, should be empty as they are never called by the container for SLSB.
4. The "bean-ness" - the ability to do different things inside a method is different for SFSB and SLSB. The ejbCreate(), ejbRemove(), ejbActivate(), ejbPassivate() methods of SFSB can access other resource managers/enterprise beans, as they have a security context available for these methods. This is not possible for SLSB as they do not have a client security context associated with these methods.
5. If the bean implements SessionSynchronization interface also, then it is a SFSB.
6. If the bean methods contain bean managed transactions and if the transaction is kept open across multiple methods, then also it is a SFSB.
7. Lastly in the DD-XML file, the type of Session bean describes whether it is a SFSB or SLSB.
[ March 18, 2004: Message edited by: Vish Kumar ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnx a lot....
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nirant,
Please take a look at our naming policy and edit your display name accordingly.
Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic